There are significant differences in the S50 and S54 engines; technical comparison will illuminate. Having owned both (and driven a S54 for over 200K miles), I would definitely seek a S54 if tempted back. Worth noting that the S50 engined the E36 M3; the S54 the E46 M3. As with all these things, personal opinions will differ. Just don't buy a S50 for S54 money.
The greatest advantage with an S54 to me would be that I could "CSL it" with bolt on parts
.
The S54 is more advanced (10 years of development ahead on the curve). It has pre and post cat lambda sensing, so the emissions are better controlled, for instance. It has fly-by-wire throttle (which can be programmed with a bit of knowledge). It has an ungraded VANOS which eliminated the weaknesses of the S50 VANOS - unfortunately, it introduced some of its own. It has a different cylinder head, but I don't think much of significance changed. Most of the improvements are in the ECUs.
For the same money, I would go for an S54. It's up to the buyer how much extra an S54 is worth.
If you do get an S54, just make sure that you use the correct engine oil (Castrol 10W/60). The VANOS oil pump tolerances are tighter.
With either car, it is vitally important to warm the oil before giving it the beans. The VANOS needs clean, thin oil to operate. The ports are very small and the pressures are very high (1400psi has been quoted).
Have fun shopping - and don't forget that it was a £40,000 car when new, so it comes with maintenance bills that you would expect with a £40,000 car.