You wouldn't be able to use your current 3.0 transmission because:
- The internal transmission components in the SOHC 4.0's are upgraded for the larger engine.
- Bellhousing has a different bolt pattern and bellhousing is integral to the trans case so it can't be swapped separately.
A 2001~2003 SOHC would need some wiring adjustments in a 98 but it's doable. Wiring a complete 2004+ Ranger engine/trans/PCM into a 98 gets progressively more difficult as the years get newer. For every 99+ 4.0 Ranger PCM except 2005, you'd need to do something about PATS, either wire it in or disable it in PCM software.
For any swap, you'd need the complete engine, matching 2WD transmission, matching PCM, matching engine/trans/starter harnesses, y-pipes and cats, engine mounts, clutch/flywheel/pressure plate and a few other odds and ends.
The stock 7.5 axle in good condition will hold up to a 4.0/5.0 2WD unless abused. For performance driving with the larger engines, an 8.8 w/LSD would be a better choice.
Remember that early 4.0L SOHC Rangers have a reputation for timing chain rattle, especially 2001~2002. Explorers also got a different version of this engine as an option starting in1997 and those earlier Ex SOHC's have the same issue. The 2003+ 4.0 SOHC is generally considered "fixed" although there are a few owners who say different.
If you got a 98 Ranger 4.0 OHV/transmission/etc/etc instead, it should be 100% bolt in and require no wiring changes other than using the matching 4.0 engine harnesses. A 99~00 4.0 OHV should also be relatively easy except for the PATS hassle.