Panacur and Safeguard are what you need to get rid of planaria.
Just be careful that after treatment, you do not introduce snails into your tanks until you have done a few weekly water changes. The Panacur and Safeguard IMO lingers after the treatment and your water could be toxic to snails.
My nerites, after I removed them and introduced them back into the tank, died within a couple of days. I'm guessing the Panacur did not wear off enough. A few weeks later and some new nerites, they are doing fine.