The first thing to be certain about is that they were in fact passed by the frog and are not the larva of a small insect that has found its way into the aquarium. If they were passed in the faeces you will need to see a vet. Place the worms in a small amount of alcohol (metho is fine) and try and get a fresh faecal sample with a bit of water added before you go.
Internal parasites can have one of two life cycles – direct and indirect. Direct means that they escape the host, usually passed out as either eggs or recently hatched larva, but sometimes as more developed worms. They then spend a period of time free-living in the environment, which allows them to locate another host and enter it. Indirect life cycles require an intermediate host, in which various stages of development will occur, before re-entering theoriginal host. Water snails in particular are a common secondary host species for parasites of aquatic and semi aquatic animals. If you have an indirect cycle parasite without the secondary host, then that parasite will eventually die out. If you have direct life cycle parasite, all occupants of the enclosure are at risk and that parasite can proliferate.
Some parasites are fairly benign. They attach themselves to the wall of the gut and as food is digested by the frog, they absorb a share there of. They pass eggs or larvae out in the faces to infect other frogs. Other parasites cause serious damage by burrowing into specific organs, such as the lungs orthe liver and causing tissue damage in these areas. Some even encyst in these organs, depriving surrounding cells of the nutrients they require to do their job. They can also occupy small blood vessels and lymph ducts with resultant reduction in blood supply or swelling of limbs or body areas due to backlog of lymph. To avoid the worst of the gastric juices, some worms burrow out of the body through the skin or encyst under the skin feeding on the fluids sent by the frog in response, until eventually they burst like a pimple to release the occupants.
This is why I recommend you get an ID on the worms. They may not be able to say exactly the species but once they know it is say a nematode, then there are several highly effective treatments – Fenbendazole (Panacur), Ivermectin (Ivermec), and praziquantel (Droncit), Thiabendazole and Levamisole(Discomed). The vet can recommend what he/she is most comfortable with. While ivermectin is not recommended as a rule for smaller animals it has been demonstrated to be safe at appropriate dilution in frogs. Parasites from different groups usually require different medications – another reason why an ID first is recommended.
If you have access to a microscope Danny Brown has an excellent book out that can be used to identify internal parasites.
While the information above is not a lot of help, I trust it will provide the understanding of what you need to do. It sounds pretty likely that you have some form of nematode which would be pretty straight forward to treat. That is, of course, a blind guess and you should not put any weight to it.
Good luck with it.
Blue