I have been getting numerous CELs lately (p0131, p0151, p0171, p0300)
Please don't make us look-up the code definitions.
For the record, P0300 is tricky. It is a valid code, but it's also what crappy bottom-feeder code readers resort to when the REAL code might be P0301--P0308. Is your code-reader/scan tool capable of displaying individual cylinder misfire codes? How about individual cylinder misfire counts?
I hooked up a fuel pressure gauge and when I turn the key on it goes to maybe 30 psi for a couple of seconds and then drops.
You might need more than one priming cycle to achieve full pressure. But the fact that it drops (rapidly?) is cause for concern.
When I start the engine it jumps to about 45 psi and stays there. When I put it in gear and hit it the pressure drops a little to about 40.
It drives okay if I'm just driving normal but when it's under load it lacks power and throws a code.
IF (big IF) your fuel pressure gauge is accurate, that pressure is way too low.
You must have the upgraded electronic injector spider, 'cause the poppet-style wouldn't run with pressure that low. Or your pressure gauge is inaccurate.
Is it the fuel pump or something else?
Could be any one--or combination--of several things.
Plugged fuel filter. How old is the fuel filter?
Low voltage to the electric fuel pump--corroded connections or failing contacts in the fuel pump relay and oil-pressure switch, for example.
Bad ground connections for the fuel pump.
Plugging filter sock in the gas tank.
Ruptured hose (or pulse dampener) between fuel pump and hanger tube.
Failing fuel pump.
Doesn't make sense to change a fuel pump without dropping the fuel filter for inspection/replacement, and verifying the voltage to the pump,
as close to the pump as practical, WITH THE PUMP RUNNING. Generally, that means testing voltage at the rearmost electrical connector before the harness goes up 'n' over the gas tank.
The service manual has specs and procedures for blocking the return and supply plumbing to test pump pressure output, leaking pressure regulator, leaking injectors, etc.