Your HSA passes to your surviving spouse.
But if you both die, the HSA is cashed out as income to your heirs. There is no ten years period to withdrawal like IRA, the cash out of inherited HSA is immediate in that year. Your heirs could use HSA for their own medical expense FOR THAT YEAR, but that's it.
So if you have too much money in HSA, the problem would be your heir will have a huge tax bill, possible paying top rate of 37%.
Let's say you have 1 million leftover in IRA, your heirs has ten years to withdrawal, so every year they get 100K, even if they work and make $240K as a couple, taxable income at 340K is taxed only at top rate of 24%.
However, if you have 1 million leftover in HSA, your heirs has to pay income tax on $1 million the year they receives the inheritance. That's top rate of 37%.