Welcome to the forum.
+1 on what Bob said.
Sensors rarely fail, but for some reason people and mechanics want to replace them 'trying' to find a problem.
Mechanics do it to pad the bill some times but DIYers do it because it seems easier, lol.
A gasoline engine is still a gasoline engine no matter how much electronics is bolted to it.
It needs 3 things to run correctly
1. air/fuel mix in correct proportion
2. spark at the correct time
3. compression, above 120psi minimum, but usually 150+psi
If an engine is running poorly or not at all then at least one of these things is incorrect.
What computer control does give us that the old systems didn't is that we can read codes from it and see live data while engine is running and while driving, which can be very helpful.
But the computer used in cars is not like your home computer or even smartphone, its got less "smarts" than a vending machine computer...............from 20 years ago, lol.
Very very basic functions, no code number is mean to be taken literally, a definition for a code number is a loose english translation of the computers 1's and 0's, gives direction but not accuracy.
As Bob said codes are the key for what may be wrong, but also what is NOT wrong, codes that are not there also mean something.
Since you have invested alot now I would add another $50 and get a Bluetooth OBD2 reader, these work on any vehicle sold after 1995, so not a Ford or Ranger specific investment.
They plug into OBD2 port on the vehicle, you can then connect to this device from any Bluetooth device, like a smartphone or tablet, and view the codes or live data on that screen, very handy item.
Your 2002 Ranger will have the 2.3l Duratec DOHC engine(Mazda L, 23NS), much different that the older 2.3l Lima engine used in 1980's and '90's Rangers, so if you search for answers to problems make sure they are for the 2.3l Duratec model.
Bogging down can be a few things, spark advance and Air/Fuel , live data could tell you what computer is doing when engine bogs down.
Either could also causes higher RPM when not expected.
Vacuum leaks change air/fuel mix
Simple test for vacuum leaks is the IAC Valve.
After engine is warmed up to operating temp, unplug the IAC Valve, it will close all the way and RPMs should drop down to about 500 or engine may even stall, either is good, it means no vacuum leaks between throttle plate and intake valves.
If idle stays high then you have a leak.
Also include if you have a manual or automatic transmission, engine controls are different for both
And I assume it is the original Ranger engine, the 2.3l duratec(23EW) car engines were different and would not work well with Ranger computer
Found a video on 2.3l duratec about bogging issue: www.youtube.com/watch?v=b9NdzJd0Csc
he also replace a few things before finding this issue
You will need fuel pressure gauge to test for this issue.
Seems pressure regulator on newer fuel pump was bad, pushing pressure up to 90psi, should be 60-70psi, caused a bogging issue