Alright, checking in.
Here's the deal.
95 Legacy OB's had a 2.2. Bombproof.
96 Legacy OB's/2.5GT's had a DOHC EJ25. Made 155hp/156tq, required premium fuel.
97-99 Legacy OB's/2.5GT's had a Phase 1 DOHC EJ25, the modern EJ25. 165/165, runs on 87. Prone to HG failures (fails internally, leaking oil into coolant and vice versa), and short skirts led to piston slap when cold even at low mileage.
98 RS's had the phase 2 block for all of production, IIRC. Not any better for HG's, but different piston skirt design for less slap.
Random 98-99 Legacies had DOHC heads on Phase 2 blocks.
98 and up Foresters, 99 and up RS's, and 2000-up Legacies had the SOHC Phase 2, which had no piston slap isses, but still had HG issues, in lesser numbers. These HG's tend to fail externally, causing an external coolant leak most of the time, and an occasional oil leak.
All 02+ Imprezas that didn't have the EJ20 got the SOHC EJ25.
Subaru hass gone through 5 or 6 HG revisions, finally coming up with a metal sandwich that fixed the issue on the DOHC cars. Very few DOHC 2.5's make it past 100k without a HG leak, it's not if, it's when. Mine made it to 120 being beat on, some people get to almost 200....just plan for it. If you're doing a motor swap, do yourself a favor, swap it out for the new gaskets when it's on a stand, and bleed the system correctly, as that's the #1 HG killer; you get an air bubble, then a hot spot, then the HG is gone. I've seen people go through 3 HG sets in 1k miles becuase the shop doing them didn't bleed the system correctly.
The only Imprezas that had the DOHC motors were the 98's, and it was a Legacy motor and intake system, with a hot-wire MAF. The 99 Impreza was SOHC, with a hot-film MAF that is susceptible to vibration. 2000-2001 SOHC RS's had a MAP setup.
I think that's it