Others will know for sure, but I don't think the wiring harness chanted significantly from 97-98 to 00-01, you should be good and not have to swap the engine harness, but I may be wrong with that.
For the transmission you'll need to remove the sensors from the 97 trans and install them in the 2001, should be just two sensors in the pan but I cant remember if the Neutral safety on the outside of the case has a different connector that will need to be swapped as well.
Other things that need to be changed is the PCM, which you'll have to ensure has the same number of case connectors, 3 vs 2. The transfer case should be fine from the 97 to just bolt back onto the trans from the 01. If you're taking the engine and trans together from the 01 you don't need to worry about messing with the torque converter or flexplate, however, if you can spare the money, and its original, it may be worth putting a new torque converter in the truck as they are a common failure point.
If it hasn't been done on the 01, remove the intake and do the plenum repair, even if its been done by the dealer it may not have been done correctly. While its out, you might as well do a full tuneup on it, plugs, wires, cap and rotor. Flushing the engine with a garden hose is optional, but pretty easy on the stand.
If you haven't pulled the engine yet, there are two ways to do so, pulling the engine and trans as a unit, or just pulling the engine. I've pulled them as a unit, and more recently i've pulled just the engine. My opinion is pulling both is easier on a 2wd vehicle, but I have no idea on a 4wd, i've never pulled an engine from one. A couple pieces of advice, remove the intake while still in the vehicle, it makes the next couple steps easy. Pull the A/C condenser and/or radiator (depending on your ability to vacuum and recharge the A/C) then remove the radiator support, it'll leave you with an entirely open front end to easily pull the engine through, and a requirement if pulling with the trans together.