I have a spare drive shaft in the garage right now, IIRC it came off an '02 or '03. I just checked and it is keyed like that.
As for whether it will fit a different Jeep, you need to consider the lengths of the different drive line components. I'm not sure if engine makes a difference (whether the 4.0 and 2.5 have a different placement for where the crankshaft output is in relation to the rest of the vehicle), but for sure different transmissions will have different lengths and therefore change the location of the output shaft of the transfer case. Also, different axles are different lengths, which will also have an impact on drive shaft length.
I know this for a fact. The reason I have a spare drive shaft is because I have a D44 axle I will swapping into my Jeep in place of my D35. My current driveline is 4.0L engine, NV3550 tranny, and NP231 transfer case. Knowing that the D44 housing is longer than the D35 housing, I got my spare drive shaft from another TJ with exactly the same driveline, except it had a D44 from the factory. Consequently, the spare drive shaft is 1" shorter than the factory one in my Jeep.