The '98 2.5RS should
be an EJ25D (DOHC) as well, not an EJ251 (SOHC). The 2.5RS shifted to the SOHC engine in '99, while the Legacy and Outback switched over in '00.
If you're getting another EJ25D, the engines should be essentially identical. I put a '98 2.5RS engine in my 2.5GT back in '06 and there were a couple of differences on the intake manifold:
I just swapped my 2.5GT intake manifold onto the 2.5RS engine so I didn't have to worry about the differences. There shouldn't be any other changes - clutch and flywheel are the same, harness and all the sensors are the same, etc.
If you're looking at an EJ251, then it will not
be a straight swap. The "easiest" way to use that engine in your '98 Legacy would be to put the EJ25D cylinder heads, intake manifold, sensors, etc onto the EJ251 short block.