Disco 2/P38 Engines

I know the D2 and the P38 share a little in common, like the axels, but how about the engines? My 97 P38 has the GEMS engine like the D1. Are the D2 and P38 Bosch engines the same? Do the P38 Bosch engine blocks have the same casting problems as the D2's? My P38 has 242,000+ miles on it. Was thinking of getting a newer one and keeping it stock (like I did the Classic, ha ha) until my current P38 dies, then transferring everything over to the new P38.