By combining the regulator with a voltage comparator, a P-mosfet and a voltage regulator, you can have both the protection and keep it functional at 5V or at 3V. (For intermediary voltages data sheets for each part has to be examined carefully and additional or other components may be needed). Note: I didn't test the present circuit yet.
simulate this circuit – Schematic created using CircuitLab
When the voltage is under the voltage comparator threshold the gate of the P-MOSFET M1 is at 0V (or GND level) and the MOSFET conducts. The 3.3V regulator has no effect. Current flows normally.
When the voltage is above the comparator threshold (e.g. 5V) its output turns high and the P-MOSFET stops conducting. Then the current goes through the voltage regulator and Vcc receives 3V.
The regulator must have a drop out voltage of less than 2V.
R1 is necessary to bring current to the MOSFET gate with the BD48 serie because it's open drain. There are other variants in the market. This is only one non-exclusive example.