Hand sanitizer with proximity sensor and pump

MarkT:
The PNP will only stop if its base and emitter voltages are within 0.4V of each other, presumably this
isn't happening. The multimeter is the tool you need all the time to see what's happening in circuits,
I'd recommend checking all the voltages are what you'd expect for each condition. Perhaps the sensor
doesn't behave like you assumed?

Hi Mark,
This is my IR sensor which I'm using

Also someone told me this which I really couldn't understand at all being a noob
"you might need low side switch (NPN) to switch ground to the pump. And as there are usualy comparators (that can sink few milliamps curent but source capability is in microampers) you might need stronger pull up or small current PNP."