They're harmless, unless their population becomes huge and then they have a massive die-off, which could cause water quality issues.

Best just to keep up on weekly partial water changes, make sure no uneaten food winds up rotting in the tank, ect.. I've had planaria and various other micro aquatic lifeforms in my tanks. They come and go, it's normal. I used to have quite a lot of planaria and then one day they were gone. I haven't bought/added any live plants or added much of anything to my tank, so that is probably why.

Things just stabilize over time. Don't sweat it, keep up on proper care and it all evens out.