They are flatworms.They can be a real pain to get rid of.
Some people say sixline wrasses will eat them.There is a product called flatworm exit,that is effective when used properly.You must be ready to do a water change when using FW exit!The problem with flatworms,is their toxic properties.When they die they release this toxin,which can affect everything in your tank,even kill.
I prefer the natural eradication method,using velvet nudibranchs.Their sole diet is FW's though,and once they are gone,you need to find a hobbyist who also has this problem to pass them onto,or they will starve.They are pretty ravenous,and will make short work of a bunch of FW's,so only get one or two.They can also be syphoned out...which helps but will not remove all of them.