For compatibility with most of standard 24V parts you need an opto coupling. The connector to controller should include leads from external 24V supply. The current should be at least 20mA, but no more than 1A per input/output. The signal conversion should absolutely include schmidt triggers. In addition to this, consider rating your insulation to 500-1000V or more, separate grounding to chassis, protection/survival of outputs to shorted load over infinite time. You need to set input impedance to about 500-1500 Ohm. (~24V/20mA with some range of sensor source impedances). One important aspect is EMO (Emergency override, the red mushroom button), what the sensor network will do on EMO - break the power ? What controller will do ? What receivers of 24V commands will do ? How they recover from power loss, what disconnection/connection does ? E.tc.
Even if it is your personal property, the 50m line makes it more than 2 resistors problem.
Basically with 50 meters of wiring the look at the schematics as a single device applies no more. It is more like wiring design for buildings or heavy machinery. There possibly is a relevant book about appropriate design rules, code etc. Depending on what industry is it.
Consider use cases with separated grounds, different AC phases powering different ends, when mains have 3 phases of power.
You can think of the solution as somewhat overbuilt, but think of extremities when long lines involved. Long line is inductive. The fast interrupt of DC current will cause a voltage spike. Long line is also capacitive, sometimes as much as nanofarads. It is open capacitor and high impedance source of noise. You need low impedance receiver to defeat high impedance noise source. Another typical requirement for travel limit switches is detection of faults: loss of connection, loss of power, fault of sensor. To control limit switch completely, power it using controlled output (that what 1A output capability is for), programmatically check limit value, unpower and check again, power it back. Otherwise there is no certainty in reading.
One interesting problem with optical limit switches is that even if they have their own hysteresis, they are still not certain. When the opening is closed very slow the limit switch will pickup the optical noise from ambient light and will send a 120Hz signal caused by external light. There is no physical way to avoid it. So treat a single reading as a probabilistic and multiple readings as statistical.