might be planaria:
http://www.ucmp.berkeley.edu/platyhelminthes/dugesiasm.jpg
Planaria commonly show up in tanks with an excess of food and most are introduced to an aquarium from other aquaria with live foods like black worms, live plants, or anything else moved from an active aquarium that has them.
If a lot of residual food is left in a tank, including dead and dying fish, snails, other animals, and plants, then a few planaria may divide into hundreds very quickly. they usually reproduce by asexual fission.
planaria can be controlled by a good vacuuming of the gravel and better tank maintenance. to remove planaria from a more heavily infested tank:
1. Set out bait like meat in a mesh bag. remove the bait a few hours after the lights go out on the tank. it should be covered with planaria. throw away and repeat until the population goes down.
2. add planaria eating fish to the tank. such species include the paradise fish, betta, pelvicachromis pulcher and many species of gourami.
3. vacuum the gravel very well and do a 50% water change. this will remove not only some planaria but their food source as well.
4. reduce the foods added to the tank. planaria often proliferate if too much excess food is provided.
5. As a last resource, tear down the tank.
note that Planaria will eat dead fish, fish eggs, and immobile fish larvae (fry newly hatched). they do not pose any risk to mobile fry or adult fish.
might be Nematodes:
http://www.ucmp.berkeley.edu/phyla/ecdysozoa/nematodesm.jpg
round worms or Nematodes represent about 10,000 species of free-living and parasitic forms. they range in size from a few mm. to 2 cm. in aquarium species. Nematodes can be introduced to the aquarium in egg or adult form. Eggs can be present in almost anything that you add to your aquarium; feeders, live plants, driftwood etc. Adult worms are more likely to be introduced by live plants and in the water accompanying your feeder fish.
the vast majority of nematodes found in the aquarium are scavengers and proliferate for the same reasons as planaria listed above. they can also be gotten rid of the same way.
some Nematodes ARE parasitic on fish and can be extremely difficult to erradicate. antihelminthic drugs are the only way to rid a tank of these -- disinfecting aquariums will do no good, as nematode eggs can be quite resistant to environmental chemicals. many nematode species have free living young and thus seeing them on the tank walls is possible. while they are not usually mistaken for flatworms, some species of both are extremely small and are therefor difficult to differentiate with the naked eye.