Bad fuel pump or bad Mass Airflow sensor?

My truck us having very hard time starting up. It cranks over, putters and shakes really bad then dies. Once it finally becomes drivable, it almost stalls when accelerating from a stop or turning right

Could this be a bad fuel pump, bad MAF, or another failing part?

Truck is a 2006 ford ranger

Put some STP or Heet in the gas tank, and pull the OBD 2 codes, then go from there.

Forget any gas additives, there's enough ethanol in pump gas to absorb most any moisture.
You're on the right track I believe. A dirty or bad MAF or bad coolant temp sensor are the most likely suspects.
Check the fuel pressure too. A bad regulator could also
cause the issues you're having.

Have the codes read and report back.

I had a similar problem, turns out I needed a new ECU.

To determine if the fuel pump is bad you need to test the fuel pressure with a manual fuel pressure gauge hooked up to the fuel rail.
To determine if all the sensors including the MAF sensor are working with in spec you need a $3,000 scan tool to read the sensor voltages.
Guessing never repairs a motor.

If you want to check fuel pressure, you connect a fuel pressure gauge to the test port on the fuel rail.

This checks the fuel pump, the fuel filter and the fuel pressure regulator.

There are 2 tests.

1. Turn ignition ON, do NOT start the engine. Read fuel pressure. Turn ignition OFF. Without turning the ignition ON again, read the fuel pressure in 5-10 minutes. Did it drop?

2. Turn ignition ON, start the engine. Read the fuel pressure.

You need to get the pressure specifications for your exact vehicle from a service manual. The pressures are usually somewhere in the 40 to 60 psi range.

-Engine overhaul mechanic and general automotive mechanic since 1972

It might just be a problem from old fuel. If this vehicle has not been driven a lot and had a lot of gas in it then suspect just "bad gas". Because it is not tripping any error codes I don't think it is either of those you mention! A new fuel filter might fix the problem. On the subject of filters a new air filter might be in order.

It is a FORD! It could be any number of problems, take it to a repair shop and have it checked out. It could be carbon build up in the intake throat, bad fuel, dirty carburetor, filter clogged, Need to change the air breather, choke is coming on or not working right, could be a lot of different things. Even a loose nut behind the wheel.