Do a search on the internet for these, planaria (sp?). As long as they are only a couple mm long, mostly on the sides of the tank, although some will be free floating, they are harmless to your fish. They can be introduced by live plants or overfeeding. Just do water changes every day or every other day and cut back on feeding for a couple days if possible.
I just noticed last night I have them in my 125g and 54g. I was hoping my UV sterilizer would clear them up, but I doubt it so I'll be doing the water changes as well.
As a side note, I had them probably 10 years ago in a 55g. I bought a microscope just to see what they were. I remember I had one on a slide. I observed that if I put a drop of unconcentrated medicine (very potent parasitic med that was blue) the worm absorbed the medicine, turned blue, and lived!! I would then cut another one in half. It just turning into 2 worms. I did EVERYTHING possible to rid them. Instead, in the process I just ended up hurting my fish. I did salt dips, disinfected the tank, ornaments, and filters. Tried various medicines for parasites. This went on for months and ended up losing some fish from the meds. At the time I never heard of these things. Finally, almost giving up as a last resort I just kept doing 25-50% water changes every other day, cut way back on feeding and got rid of the live plants. I haven't seen them since recently, 10 years later....
Hope this helps