Root beer used to be made from a mixture of Sassafras root and wintergreen leaf. However due to the potential carcinogen content of both of them, the USDA long ago banned their use, and root beers today use some other (usually artificial) flavoring mixture*
Sarsaparilla is in the same boat as sarsaparilla root is also suspect.
*I say "usually" because there are a lot of "organic" root beers on the market (like Virgil's) that say they use "no artificial flavors", so I have NO IDEA what they are using.