Same trans model (4L60E) ?
Both 4WD? (I think with yours being a Z71, that means 4WD by default -?)
If both are true, it should fit. That doesn't necessarily mean 'direct' / no mods, but it can fit.
A 4L80 is longer, so you'd need to shorten your driveshaft if you were swapping trans models.
A 2WD trans has a shorter output shaft, so you'd need to swap that (via opening up the case), and swap the tailpiece as well (to accommodate the t-case), if the trucks differ between 2WD / 4WD.
You'd also have a driveshaft length issue, if you're *wanting* to go from 2WD to 4WD, or vice versa. If you have access to the donor truck's driveshaft, it makes it a little easier. Otherwise, you're looking at shortening / lengthening yours, depending on which way you go (or sourcing a different one from a junkyard, etc.)
Cab / bed size can be a factor, if your stepside is a regular cab, and the donor truck is an extended or crew, or has a long bed. Again, this has to do mostly with the driveshaft length. The trans tunnel should be roughly the same width, etc.
If the donor trans is still in the other truck, measure the length from the center of front / back yokes (trans and differential). Then compare to what you have in your truck, same measurement.
If your truck is a SBC, and the donor trans came from a truck with an LS, you may want to swap the bellhousing from your old trans (the LS bellhousing has an extra bolt hole, top center).
If the new trans isn't either a 4L60 / 4L80, I'd not swap it in, tbh. Reasons vary, so I won't detail here, plus the odds are heavily in favor of each truck having one of those two units.
You need to give some more details / info on what you've got, vs. what you want to put in, for someone to advise further / with more certainty.