setup your voltage divider, and then from the output of the divider a 2.2k or so resistor to the pic pin, so you limit the curent into the pic pin?
If resistors creates voltage division are high enough, current from it is small enough to go directly to MCU pin (usually max limited current to MCU I/O pins is 20-40mA, depending on MCU) - no need extra resistor. However, then zener cannot be used properly, as require some minimum amount of current.
If resistors have too small values, zener can be used and then extra resistor to MCU pin is required. However, then extra resistor may influence on significant voltage drop and reading is unreliable... However, if use small resistors for voltage divider and use it to measure high voltage, resistance is too low in order to prevent burning...
As well, with large difference between R1 and R2 forming voltage divider, there is a problem with accuracy, especially with 10-bit ADC, commonly used in small or older MCUs. Further, extra protective clamping diode can influence on main rail voltage rise enough to destroy circuit, etc. And we are back at beginning...
It cross my mind also to use digital resistor ic (to form R1 with fixed 20K) for such large 0-40V range monitoring, however not commonly available for me.
In any event, it was strictly theoretical issue.