You can do it yourself but normally you would use a solicitor. You or your solicitor will have to deal with the new building society's solicitor to close the old mortgage and obtain the new mortgage.
It is possible, with some building societies, for you to use the same solicitor as the new building society. This greatly reduces the cost. You will be able to find out this information from the new building society. information pack
If you do it yourself, there are books available that will guide you through.