I had the same problem with a Fysetc F6 and later S6 controllerboard. Depends a little bit on the sensor type. Mine was rated 10-36V and had a NPN output. Some are rated for a 5V working voltage, some have NPN outputs, some PNP.
I created a small circuitboard with a OptoCoupler and hooked the Inductive sensor to 24V. Via the optocoupler it interfaced safely with the F/S6 controller. Another solution is to run the sensor on 24V or 5V depending on the type of sensor and add a Schottky diode (BAT85, 86 or BAT46) in series with the signal line to the controller, Kathode at sensor side, Anode at controller side. If your sensor has a PNP output you can create a simple resistor divider with 2 resistors. Values depend on the working voltage of your sensor. This is a bit Quick and Dirty. I prefer an optocoupler solution. You might invert the active signal level in your firmware in this case. Be careful, a 24V signal level from your sensor can destroy your controllerboard when connecting things wrong.