In terms of prestige they're pretty equal; St Andrews has the edge internationally, but Durham has it nationally, so this factor is pretty negligible.
With regards to teaching, Durham is brilliant. Whilst I haven't experienced much of St Andrews, after going to multiple philosophy and politics lectures given by Durham lecturers I can tell you that they're of a very good standard.
Also the student experience is better; Durham has the best of both worlds. Similar to St Andrews it's very old and 'pretty', and the inner city can feel like a small town at times. However, it also benefits from many of the features of a city, that St Andrews doesn't have ie cinemas, bars, clubs. It is also a couple of quid train ride away from Newcastle (my city) which has a great night life. Coupled with that, most trains which run north to south go through it because it aligns itself with Newcastle and Edinburgh, which is very convenient for lugging bags up and down (unlike St Andrews.)
Finally the collegiate system is a massive benefit in that it provides a security blanket for anyone nervous about moving from home, and ensures that you'll find a group of finds. On top of this the locals are hilarious.
Hope this is of help!!