It depends on your contract. O2 Refresh allows you to upgrade your phone whenever you want, as long as you pay it off beforehand.
Other contracts won’t let you upgrade until at least a year. Whilst others also let you upgrade early but will charge a fee.