The old 4.0l OHV, popular swap, only had 160HP, your 2.3l Duratec had 144HP, so not a good swap
Ford switched Rangers(1983-2000) from the Lima family of engines 2.0/2.3/2.5, 4 cylinder 119HP, to the Duratec 4 cylinder in 2001, first the 2.3l(2001-2010) then the 2.5l(2011-up)
Lima and Duratec engines are not related in any way, so you don't get confused when looking at engine info posts.
Swapping to a different size engine always requires swapping engine wiring harness and computer, Ford added PATS(passive anti-theft) to the Ranger computers in 1998 so that adds another layer of complications.
And yes, 4cyl trans may not fit or last with more torque from a larger engine, same with axles.
IMO, your best bet is to find a low mile 2.3l duratec engine and put that in.
Put vehicle up for sale and buy another Ranger with a 4.0l SOHC engine 207HP