transmission internals should be the same (both are going to be 46RE), count splines on the input / output shafts to be sure, there may be other internal hard-parts internally that are stronger in the 4wd, (planetary gear sets may be 3 pinion on the 2wd and 4 pinion on the 4wd, though that is not always the case (they are inter-changeable)) biggest differences as far as model years is the wiring connectors and the solenoids use sensor types from the vehicle you are putting the transmission into. personally in the position you are in, i would transplant the motor from the 2wd and put it into the 4wd, mainly because, well... 4wd.
the 2wd has a different tail shaft/housing. the case will need to be pulled apart and swapped out to interchange the transmission, and at that point wouldn't be terrible to overhaul anyways.
i believe the torque converters are the same 5.2L / 5.9L between them as 96-97 they changed where they were balanced (please confirm elsewhere though) at any rate, i highly highly recommend getting a new one anyways. transmission is down and out, relatively cheap to not have to possibly pull a transmission in the next few months anyways, any contaminants in the fluid could stay there and burn the transmission again, or burn the torque converter out faster. i know $100- $140 seems like a lot to drop into something that could be fine, i was hesitant as well when i first started really doing tranny swaps, but in the end it is worth it especially when considering it almost takes that amount of money for the ATF+4 fluid. if you cant get a new one attempt to flush it out as best as you can with ATF+4, and save for a new one asap.
i did just rebuild a trans in 97 Ram 1500 (4wd version though), and are not too entirely difficult if that is an option for you. i have a transmission rebuild/repair thread on here if you care to take a look at that, i had included a link to a yt vid of complete step by step disassembly of these transmissions.