To transfer your number to new network you need a PAC (Porting Authorisation Code)
You need to request a 'PAC' code from your Network Operator. It is free to get and they are not allowed to charge for it.
They are legally bound to deliver to you within 2 days of the request, if they do not, they have to explain the reason why they could not/cant do it.
Below are the main Network Operators in the UK, and details their Customer Service numbers you can use to request a PAC code.
3 (Three): 333 from your mobile (or 0843 373 3333 from a landline)
EE4G: 150 from your mobile (or 07973 966 250 from a landline)
O2 – Pay Monthly: 202 from your mobile (or 0844 809 0202 from a landline)
O2 – Pay As You Go: 4445 from your mobile (or 0844 809 0222 from a landline)
Orange – Pay Monthly: 150 from your mobile (or 07973 100 150 from a landline)
Orange – Pay As You Go: 450 from your mobile (or 07973 100 450 from a landline)
T-Mobile: 150 from your mobile (or 0845 412 5000 from a landline)
Vodafone: 191 from your mobile (or 0870 0700 191 from a landline)
Giff Gaff: Request online in your account.
Once you have received your PAC code you have 30 days to use it- Which means when you get your new sim, you contact the customer service department of your network. If they are one of the above listed then then you can call the number listed above
Hope this guide has been helpful.