Difference between 95 5.9 and 02 5.9

Can anyone tell me what the difference is between a 2002 5.9 and a 1995 5.9
Looking to replace the engine in my 2002 Dodge truck.I can get a nice low mileage 1995 but all of the yards tell me that it won't work in a 2002
I have worked on a lot of magnums and thought they were all basically the same
Something must be different I don't want to buy the 1995 and then find out that I can't use it