On the day of completion, the conveyancing solicitor will receive funds from the new lender. Then pay the mortgage balance and other fees to your old lender. Any left-over money will be sent to you.
Once the old lender has received the funds, they will remove themselves from the Title Deeds.
The conveyancing solicitor will contact the Land Registry and request for the old lender to be removed from the Title Deeds and replaced with your new mortgage provider. The updated Title Deeds will be sent to your solicitor and then sent to you.