You need to verify the following:
* Engine: The transmissions are matched to the engine. A transmission from a V6 won't fit a V8, and vice-versa.
* Transmission type and model number: Even with the same engine, different transmission models might have been used. You MUST find the exact transmission model number for both trucks.
* Drivetrain: A 2WD transmission won't fit a 4WD truck and vice versa. Transfer case compatibility is also a major factor in 4WD trucks.
* Output shaft: The length and spline count of the output shaft must match the differential.
In short: While *likely* similar, it's not certain without knowing the exact specifications of the transmissions from both trucks. You need to obtain the transmission model numbers from both vehicles to confirm compatibility. A parts store or mechanic can help with this. Simply matching the year is not sufficient.