Asalamualaikum, I get deep anxiety about death, and especially about family members dying, this happens mostly when I try to focus on worship. And goes away usually when I do something haraam, im assumimg its from Satan. But how do I get rid of it, because accepting it will happen has not helped.

Ustadh AbdulAziz al-Haqqan
The treatment is firstly to seek medical help. What the scholars encourage regarding waswasa is to turn away from it completely without arguing with it, to seek refuge in Allah from the shayṭān and to keep to dhikr, because the Prophet ﷺ said when one of you finds this, let him seek refuge in Allah and stop (agreed upon).