If you want the 500k cap gain exemption, don’t get divorced and don’t move before you sell. There is a time period between exempt sales, so if you claimed it on another property you might want to hold to wait it out.
I think holding for a year you will likely make another 6-12%.
If you are buying another place, getting it while you are still working will simplify the mortgage process.