Magnetic disturbance created by esc and cables

How far should the cables and esc go so that there is no magnetic disturbance on the Pixhawk?

Best is to use a GPS which includes a magnetometer. You can then put the GPS on a mast.

In general it depends on the amount of current that flows through the wires, and the further away the better. You can also upload a log to https://logs.px4.io and then check whether you see a strong correlation between throttle and mag. If you see it, it’s too close. You can even do that test without flying while holding or strapping down the copter to get the data.