I’m not the best at this electrical engineering stuff, so if anyone else has suggestions, please chime in.
Without knowing your specifics, I think the key is that you want to take the 5V PWM output from the sensor and convert it up to your 12 volts before transmitting it on the cable. On the MCU side, you want to take that up-converted PWM signal and translate it back down to 5V or 3.3V. To do that, you need a logic level converter.
Here is a resource for Digital Buffers that should be helpful. The bottom of that article has some suggested chips. While looking at Mouser, you might use a TI CD4050B Non-Inverting Buffer that is specifically used for logic level conversions. The CD4050 would take your 5V and convert it up to 12V on the cable. When trying to find a chip that would do the reverse (12V to 5 or 3.3V) I stumbled upon the datasheet for a TI DS26LV32AT Quad Differential Line Receiver. I think the application notes on page 7 show exactly what you are trying to do. The DS26LV32 receiver is paired with a DS26LV31 transmitter using a twisted pair cable (Cat 5 ethernet patch cables for example). Those DS chips approch $2 each but are well worth it so you don’t have to design the driver circuits yourself.