Those are worms. If you ask most will say planaria, but i believe they are thread worms... typically resulting from too much feeding and not enough cleaning. I'm going through the same issue in one of my tanks, I just spent 3 hours cleaning every inch of my 25 gallon and they still aren't gone. If you have fish they supposedly eat them.
What do you have in your tank? What is your cleaning, water change schedule? How much do you feed? Are the worms only in the water column or are they also in the substrate?