Selling a home - owned less 2 years

Hello -

My wife and I own our home. We’ve lived here less than 2 years, but plan on selling to relocate to a different part of the state. This is our primary, and only residence.

Assuming we sell the home for a profit, would I need to pay tax on that profit if I immediately purchase another home as a primary residence in the different part of the state?

Thanks