Check fluid level with engine OFF
Start engine and re-check fluid level, if pump is working it should have dropped, if its the same then pump is broken, needs a full rebuild to replace
With engine started shift in to 1, if it engages but D didn't then one-way clutch is bad, full rebuild needed
No working engagement pretty much means transmission will need to come out, but drain the fluid and check it for metal bits and check the filter
Metal bits/flakes will mean full rebuild
1999 Ranger 4.0l with 5R55E can use 1998 thru 2011 5R55E from a 4.0l as a replacement, OHV or SOHC doesn't matter
If 3.0l then its a 4R44E but can still use an automatic from another 3.0l 1995 thru 2008
2WD or 4x4 matters, has to match what you have now