Very sorry to hear that. According to the IRS, while still required to pay taxes on your 401k cashout, you can be exempt from any premature distribution penalty (normally applied to taxpayers before 59-1/2).
That exception applies to both for total and permanent disability if you
qualify. Disability (per IRS) means that you have been examined by a
physician and the disability is such that you cannot work, and the condition is
expected to last for at least one year or result in your death. IRS
72(t)(2)(A)(iii)
Also, notice in the link below that the amount of unreimbursed medical expenses over 7.5% AGI are also free from penalty.
Let us know if you need any other help in the comment section.
Here are the other
exceptions:
https://www.irs.gov/retirement-plans/plan-participant-employee/retirement-topics-tax-on-early-distri...