The autopilot computers and motor controllers on the pypilot store are not entirely waterproof. Most boats generally have a few places where water doesn't drip from above or spray from any direction (hopefully) and the autopilot should be mounted there. The holes in enclosures are meant to face downward.
The motor controller can carry large enough currents to affect the magnetic sensors. Try to keep the motor controller not directly next to the compass sensors as much as possible. From here, long wires can reach the actuator.
If using rudder feedback, or other additional motor controller features such as temperature sensor for the motor, it may make sense to locate the motor controller closer to the actuator. In this case use 20-24 gauge 4 wire copper like phone cable, or ethernet will do. In this case it is helpful if power for the motor controller is nearby in evaluating if this option makes sense.
For more waterproof ability, you can use sealant or use an additional enclosure, however if left open, the heat from the raspberry ensures no water accumulates and that the air inside remains dry which reduces oxidation of the solder connections on the pcb. I would suggest using desiccant if completely sealing electronics.