Protection circuit design using crowbar
The following circuit will reduce a 40 V input to 5 V, and will limit the maximum output to about 5.17 V



simulate this circuit &ndash; Schematic created using CircuitLab
A drawback of this circuit is that 7.35 k\$\Omega\$ is not a standard 1% resistor. However, it can be made by connecting two resistors in parallel or in series.
Here is a curve showing the output.

If needed, the output can be fed into a op-amp voltage follower.
The input/output characteristics can be modified by changing resistor values.
If the output voltage needs to be level-shifted and/or amplified, an op-amp may be used. Depending upon the op-amp circuit's input impedance, one or more resistor values may need to be modified.