You could
use two pins, provide 5V on one and 3V3 on the other, and wire the sensor accordingly.
provide 5V, and let the sensor derive 3V3 from it if it needs that voltage
use an LM317-style regulator and let the sensor provide one of the resistors that determine the output voltage
provide a constant current, and have an appropriate zener diode in the sensor. fore extra points, modulate the drop voltage to communicate the sensor value back to the host.
start at 3v3, have a microcontroller in the sensor, which communicates with your host to ask it to raise the voltage to 5V if it needs such for its sensor
If the sensor needs to be low cost and an extra power pin is no trouble the I would choose the fist option. If adding a pin is a nono the second seems a good choice. The third would be OK only when you need a wide variety of voltages, and can't put the regulator in the sensor. The last is for completeness only, there are products that work this way but for a sensor it feels much too complicated.