I have an iPhone 6 Plus and would like to upgrade to an iPhone 8 Plus, my current iPhone is on o2. Would I have to buy my new phone from o2?

Could I buy it from somewhere else and just put my sim in?

You could, but it would have to be unlocked.

In this case I'd advise getting it from O2 (assuming you plan on sticking with them for the 8 Plus)