My very first filter had a heater inside the filter itself, so in yes you can have it next to your filter.
If you ran the heater out of water then yes it would burn/melt the plastic holders, i know this because i once left my heater on when i emptied the tank. The heater melted to the hodlers and to the sides of my filter box. With lots of smoking and sizzling. But in the water the heat is transferred to the water and thus doesnt actually burn because its submerged.