If it is only when going to bed and not at any other times...like walking a lot or doing physical work etc, then mots probably it is not of cardiac/pulmonary in origin i.e in plain words it may not be because of heart or lungs.
Yes, It could be because of the recent bereavement and may be part of anxiety
If you are able to go to bed eventually, then for the moment best thing to do is to wait till you get settled mentally and not use any medication for this. But if this is effecting you a lot and disturbing your sleep and you work the next day in groggy mental state and that too if you drive or operate machinery or do such work where you will be a danger to yourself or others, then you may ask your doctor for tablets to help, for a very short period ex two weeks. You should also seek help if this is continuing for a long time.
But I would say, go see a physician first to rule out physical causes.