If they are both automatic the trans will bolt up to the engine but will not run, either you get the computer and harness for the 5.2 or you get the one for the 45rfe but they are worlds apart. If you get a complete donor truck you can swap EVERYTHING over, harness mounts engine computer (toss the trans computer for the 45rfe over your shoulder as the trans computer is inside the engine computer on a 5.2) the little body computer inside behind the glove box... and the donor will have to be a 2000 or you will be swapping more interior stuff out, possibly all interior if it is 01-04. A 2000 5.2 is about as rare as hens teeth as they switched over to the 4.7 early in the model year.
If they are both manual trans then they use the same trans(different flywheel) and you can swap under hood harness, ECU and body computer behind the glove box.
The 5.9 is the same as a 5.2 on the outside but they all came with a 46re trans as oposed to the 5.2 that came with either a 44re or 46re. 5.9 is more common in 2000 than a 5.2. If you are going to bolt the 5.9 up to the manual trans you will need a 5.2 manual harness and a 5.9 magnum flywheel or drill weight out of your 5.2 flywheel in a certain spot.
I am not causing global warming, I am just trying to hold off a impending Ice Age!