If you look closely, you'll notice that those worms sometimes line up their little bodies against the glass to spell out a message: "SIPHON THIS TANK".
(Sorry, I'm being silly.) Seriously, they probably aren't harmful. If you have newt larvae, they might eat them, but they're too small for adults. Probably there is a place in the tank where some waste material is sitting, and that is causing a temporary population explosion of these critters. If you do some extra cleaning for a few weeks, they will decrease. I have had them (or something similar), and they went away without any major overhaul of the tank. I just cleaned out all the crud from under the rocks in the tank.