You can siphon them out by taking a powerhead and attaching vinyl tubing to the ends. Attach a fine mesh bag to the output. That way, you can suck up the flatworms, they get trapped in the bag, and the water exits back into your tank. Remove as many by hand, because as Yote said, when Flatworm Exit kills them, they will all float out and poison your tank. As soon as you use the Flatworm Exit, have a net or your powerhead contraption ready to suck all the bodies out ASAP. And have carbon and water on hand to do a water change and purify when you are done.