This is the relevant bit form the HMRC link:
Selling your home and giving the money to your children
If you sell your home and give the money to your children, the gift won't be included in your estate for Inheritance Tax purposes, provided you live for seven years after you make the gift.
However, if you sell your home, give the money to your children and then move into their home - whether this is into a granny annex they've made for you with the money or a room in a house they have purchased - there could be Income Tax implications. You may be classed as living in a pre-owned asset if you don't pay the market rent.
If both you and your children sell your homes, pool your money and buy a new home as joint owners to live in together, the part belonging to you will be considered part of your estate for Inheritance Tax purposes.
If you don't make equal contributions to the purchase, or don't occupy the same share of the property as you purchased, you may have to pay Income Tax as your share may be classed as a pre-owned asset. See the link below for more details about pre-owned assets.