TPS ...maybe.
Throttle Position Sensor(TPS) tells the computer(PCM) where your foot is on the gas pedal.
It is located on the upper intake connected to the throttle plate.
It works the same as a light dimmer or volume control, the PCM sends it 5volts, and the TPS sends back 1 to 5 volts depending on where the throttle plate is,
1 volt closed
5 volts wide open throttle
You can test a TPS with a OHM Meter or Volt Meter, just manually open and close it while testing its signal.
The TPS can get "dead spots" so if you hit a dead spot while driving the voltage can drop to 0volts so PCM thinks throttle is closed and idles the engine, RPM drops, until you move your foot up or down on the gas pedal, getting TPS off the dead spot.
But engine shouldn't stall even if TPS sends back 0volts.
You could have a fuel pump relay issue or fuel pump issue, even fuel filter.
Fuel filter is $10 and easy to replace.
Does engine start and idle now?