If it's the long thin one in the blue part of the photo, I would say some kind of "earthworm" (like tubifex or blackworms). Then it's not only harmless but also good for the substrate and great fish food. If it's something else you're referring to here's my very unscientific key to aquarium wormy things:
1. Is it barely visible with the naked eye, flattened, and glides over the bottom like a snail, then it's some kind of flatworm. If not go to 2.
1.1 Is the head triangular with two distinct eyespots, then it's a planarian, otherwise some other kind of flatworm (generally smaller too if you can compare the two).
2. Bigger and with a cylindrical cross section, maybe even with some segments showing, then it's probably some kind of insect larvae. If it's very long compared to its girth go to 3.
2.1 Transparent and hovering in mid water = Chaoborus (white mosquito larvae), reddish and sitting on the bottom = Chironomid (red mosquito larvae), then there are many others of course...
3. Long, thin, and with segments showing when watched closely, then you have an annelid.
3.1 Moves in a classic "wormy" way = aquatic "earthworm", moves like a caterpillar = leach.
Chironomids, "earthworms", and most flatworms are completely harmless (and actually beneficial). In a tank with slightly larger fish the only ones I would worry about are larger leaches, and maybe planarians since a lot of them indicate that there's plenty of meaty food around. With fish fry/eggs and shrimp some flatworms, Chaoborus, and leaches can be risky, so watch carefully.