Modern fuel pumps in cars and bikes have the fuel run through the electric motor part of the pump, and the pump itself. The fuel cools and lubes the parts.
It seems crazy to run gasoline through a DC electric motor, but for some reason, they do not explode.
Everything I ever looked at had a fuel pressure regulator outside the pump, in some cars its on the fuel rail and excess fuel returns to the gas tank. The pump runs all the time the motor is turning, and runs for a bit with key on to build up pressure. The pump can supply more fuel and pressure then the motor can use at high rpm's, full throttle, cold engine. Once fuel pressure gets past the regulator set point, it pushes the regulator open and fuel returns to the gas tank. Some cars have/had a vacuum assist on the regulator, open the throttle, vacuum goes away, fuel pressure goes up a bit.
Bikes have the pump and regulator in the gas tank as an assembly.
Run low/out of gas and there is no fuel to lube and cool the pump and its motor, which has a large amount of plastic in it, and the hot spot is the brushes. They tend to melt their holders.