Long wires and float switch problem

With that length of wire you might need stronger pull up, like a 1k resistor.
And a 100n ceramic cap from pin to ground.

I assume you have used shielded or twisted wiring for your sensor (Cat-5). Not just twin flex.

Never a good idea to run low voltage wiring next to mains power wiring.
Leo..