You should expect to spend around $450 for a machine shop to clean the block, bore & hone it and install cam bearings and to press the new pistons onto the rods and polish the crank. From there expect to spend a minimum of $500 on internals to do it right (pistons, rings, bearings, oil-pump, timing set, full gasket set with bolts) Add another $200 to replace your rocker arms & pushrods and another $250 for new lifters. Add $70 to have your injectors reverse flushed and sonic cleaned. I did all of the above and added the Comp 410 cam and the Comp 988 springs for about $350. I upgraded to Clevite bearings and the Melling 328 high volume oil pump for a few dollars more and then added a set of Titanium-Ceramic coated JBA headers. I spent more than I had anticipated but I got some experience rebuilding an engine that will last a long time.
Lessons learned. Because I have OCD when it comes to "doing it right", I don't think I would rebuild a Ranger engine again for myself. If you really think about it you will come to the conclusion that the Ranger is a real turd of a truck when you compare it to a full-size. Fuel economy, towing & payload, comfort, utility, etc. Unless your truck is sentimental or causing you trouble I'd just keep driving it. You'll probably never pay for the cost of a proper rebuild with fuel savings alone (your 18 year old truck only has averaged 11k miles per year. It probably make about 12-13 mpg now if I had to guess. If you improved that number to 16mpg at the cost of $1,300 paying $3.30/gallon of gas you will save $ 525/year. If you don't drive it that much then it will take you a lot longer to recoup the cost. You'll have to face the fact that you have an 18year old truck that might have other issues going on and the fact that rebuilding the motor won't add much resale value either.
I will say I'm in about $3k which includes some other repairs but I intend to continue to use the truck. I wish I would have spent less but I'm happy with what I've got.