Flatworms don't eat corals. They're photosynthetic - the problem is that they multiply easily and can cover the corals. Even then, I'm not entirely sure what damage they do.
Many times, especially in a newer tank, the population will swell, then crash on their own. If not, there's a product called Flatworm Exit you can try. That's got it's own set of issues, so first, I would try to siphon as many of them out as you can, then wait it out.