I had an outbreak of flatworms and maybe this will work for you.
I found a rock where most of the flatworms would gather,lots of them
it was a blue mushroom rock,didnt hurt the mushrooms at all.
pull the rock out and dunk it in fresh water for a couple of seconds,like 5 sec.
make sure water temp is the same as in the tank
swish the rock and pull it out then return it to your tank
all the flatworms fall off instantly and die in the fresh water
let more accumulate on the rock and do it again at least 24 hrs later or more.
then add a sixline wrasse. the wrasse can only do so much so try to kill off as many as possible.
worked for me , haven`t seen a flatworm since. and I have a very healthy sixline wrasse. Be careful with the wrasse though,they are jumpers and will slide out of any small holes in the lid of your tank.make sure it`s sealed off,or use filter foam to block off any holes.
(ask me how I know.)
Good Luck !