If they are flat worms you should be able to just pick them off the star. It's very unlikely they are doing any harm to the star. In fact they are probably cleaning it. And if they are on the star, it's VERY likely you have more on your soft corals (look closely at mushrooms, ricordia and leathers.
If your star really is a Linckia, be careful and gentle with it. And best if you can not pull it out of the water. Some stars get air trapped inside and then can't get it out and die.