It used to be that a homeowner who sold a principal residence could defer tax on any profit if they purchased a new home within two years at a price equal to or greater than the sale price of the old one.
That ended with the Taxpayer Relief Act of 1997.
So buying another home will no longer relieve you of having to pay capital gains tax.
**Answers are correct to the best of my ability but do not constitute tax or legal advice.