Does anyone here have a chronic condition that affects them mentally? If so, how do you deal with it such that you can stay as the oak and Captain of the ship?

I was born with congenital hypothyroidism and while I try my best to keep myself in check, especially mentally and emotionally, during the troughs in respect to my health condition I am emotionally all over the place and I become so weak and struggle to keep my head above the waters and staying balanced.

This condition is known to cause mood swings and I do engage in a lot of meditation, etc. The only issue is that in a lot of times, these mood swings or extreme bouts of depression/anxiety catch me off-guard and I tend to notice this a little too late after possibly having caused some level of damage to my relationship.

If anyone has a similar life experience and has figured something out in their life, then please feel free to share it. At the moment all I end up doing is withdrawing and closing myself off and staying in my head until I sort myself out or get through the storm. But I know this is unhealthy.

Thanks in advance