Using 5V motherboard pin
For the 5V from the header pin, if it's always on (when the PC is off if you also use it to power on the PC, you can test this with a multimeter for example) and you're not drawing a lot of current (can you specify what's your sensor?) that could be a good solution.
For shorting the button of the PC, if you want to be absolutely sure to make it work without any risk of damaging anything because of a wrong voltage I recommend you to use a relay instead:








simulate this circuit &ndash; Schematic created using CircuitLab

You can find really cheap relay modules with integrated optocouplers on the Internet to avoid pulling to much current on your sensor