Glasgow is a much larger university. (Glasgow as a city has a higher population than Edinburgh). St Andrews is regarded as more prestigious in general (it has the highest percentage of private school students of all UK universities - 40% and is popular with Americans) but some people pick Glasgow over St Andrews because Glasgow ranks more highly for some subjects, Glasgow has far more to do in it as a city, Glasgow has very old buildings itself, and Glasgow teaches Law which St Andrews doesn't. St Andrews is Scotland's oldest university and the third oldest in the UK. Because St Andrews is relatively small (1335 teaching staff versus 5555 at Glasgow) , it'll only produce about a third at the very most of high quality research that Glasgow does (71% of St Andrews' staff do which is 948 staff, 57% of Glasgow's staff do which is 3166 staff) and the quality of Glasgow's research for all subjects on average is actually higher (86% at Glasgow. At St Andrews, it's 83%).
Since you're doing it online, it won't affect you that St Andrews is small and can feel isolated to some. For international prestige, choose St Andrews as long as the course appeals to you as much as Glasgow.
However if you genuinely care about teaching quality that might be better at Glasgow as St Andrews don't offer education degrees at undergraduate level.