hey i have some in the tank that i'm cycling now which is strange so they must have come from another source from another aquarium that had them. there's not a lot of them, like maybe 8 tops but I've just been sucking the ones I see out with a turkey baster, and then do very big water changes daily with dechlorinated water and make sure you clean your substrate very well and eventually they will starve to death and should diminish. I think they are called planaria worms. as far as i know they are harmless but the reasons that cause them could be harmful which usually point to bad water quality.
definitely test your water, you can usually take it to pet stores and they will test it for you. or buy some ammonia test strips and nitrate test strips (handy to have around anyway and last a long time) This could point to the reason. Mostly they just thrive on uneaten food and waste so be sure to suck out any poo or uneaten food asap.
Good luck :] (this is a common problem in aquariums so don't get too frustrated)