Hi, cool, welcome. I love to see people asking about restoring 1st gen Rangers.
The 4.0 being the "best" way to go is kinda subjective. If you already had a 2.9 in place, especially if it were an 88+ 2wd then yes, the 4.0 would be the way to go. In your case, there are many other factors to be considered.
1) Budget
2) Skills
3) Desired outcome
Anything but another 2.3 will require a good budget and some skills. It will require replacement of the trans.
If you want power the 4.0 and 5.0 are the top choices. A good, well done 5.0 swap can also net some good gas mileage. A 5.0 will also be the easiest engine to carb if you go carb, but came with FI as well.
I just put a 4.0 in my 87, love it love it love it. The big draw of the 4.0 for me was that it was very similar in design to the 2.9 it was replacing, lots of parts compatibility, and so I was able to do the project over a span of several years without having the truck down for more than a week or two at a time.
If I had the project to do over, and I had to do it all at once, engine trans, etc, I would go 5.0 I think.