I believe the whole series of Ranger engines were "stretched out" (all the way to 4.0L) versions of a smaller original engine, but not sure what the original was.
Had a 2000 4.0Ranger 4wd auto trans. It is the main reason I now have a Tacoma!
Between 90,000 and 105,000 miles I had the trans rebuilt, upper control arms replaced, and the 4wd was acting up when I traded it off.
Look at the front wheels (from the front) and you'll see a lot of Rangers on the road with the top of the front wheels tipped inward (camber) and the inside edges of the tires worn. This will require replacing the upper control arms and getting it realigned. IIRC this cost me about $550.
As a "bonus" the gas mileage on the 4.0L I had was terrible!!! Don't know about the 3.0 version.