Without seeing the worms it is impossible to know if they are parasites or from the soil. I would tend to suspect they are from the soil though as most parasitic worms I have seen in frogs appear clear not reddish. Even if they are parasites it isn't the end of the world, they can either be treated or the worms will gradually thin out or disappear over time on their own in a captive environment. Rarely do worms cause frogs significant issues unless the worm burden is very heavy and the frogs are stressed.