If D9 has never been touched before, then it is in input mode at the beginning (after reset). Using your first proposed sequence
pinMode(9, OUTPUT);
digitalWrite(9, HIGH);
makes the pin "active", it will be internally connected to GND first, then switched to HIGH almost immediately.
If you swap the two lines, then the internal input pullup resistor will be activated first, pulling the pin "slightly" HIGH. Then the pin will be made active and pulled "really" HIGH.
For a passive sensor it does not make a difference at all. The distinction is only relevant if you are driving some sensitive input like a relay board involving an input amplifier. Making the pin HIGH first may transmit a HIGH signal although the pin is not yet an output pin.