Difference between 95 5.9 and 02 5.9

The basic long block should be the same, unless I'm missing something; but you will have to swap over your existing sensors, fuel rails, throttle body, injectors, possibly the distributor, etc. since a lot of things changed over the years like connectors, sensor ranges, fuel return styles, and such. Not to mention the overall change from OBDI to OBDII.
Depending on the application of the two engines, there can also be differences in the accessory mounts. There will be a difference in the harmonic balancer, as the '95 used a two-piece balancer/pulley and the '02 is a single piece- but that shouldn't keep you from using it since they are functionally identical.