How long it takes can depend upon which phone service provider you're moving to. For example, here's what Asda Mobile's website says about transferring an old number to their service:
"If you submit the transfer request before 5.00pm Monday to Thursday, your number will be transferred the next working day. Please note that we don’t transfer numbers at the weekend or on bank holidays, therefore if you request to port on a weekend or a bank holiday your number will be transferred in 2 working days. This transfer will happen between 05:00 and midnight and on the day of transfer you will lose signal on your old SIM card."
Source:
https://mobile.asda.com/help/transferring-your-number/PAC-transfer
There will probably be something similar on the website of whichever new provider you're moving to.