Segmented worms or more specifically:
Planaria
(Platyheminthes)
Planaria are flatworms, with mouths located under the middle of their body. They are related to flukes and tapeworms. Planeria are hermaphroditic and can reproduce sexually, though the can't fertilize their own eggs, or asexually by splitting in the middle.
Planaria are often confused with leeches, though they can be told apart easily be visual observation. Planaria have horn like protrusions from the sides of their head and eye spots.
Planaria can be a problem in the aquarium in tanks with egg laying fish that don't protect their eggs. The planaria are voracious fish egg eaters. They are also very hard to get remove from the aquarium, and will often transfer to other tanks on plants.
I personally don't know what treatment to use, but I'm sure Mardel Products or Jungle has some med that would work.