When the heart is busy with this worldly life, a person will look for worldly means to find relief from the calamities and difficulties of life.
And when the heart is connected, and its concerned, and its busy with Allahﷻ, the first thing that comes to a persons mind during difficulties, is Allahﷻ.
The way you live your life is going to dictate how you respond to a difficult moment.
The Prophet ﷺ said:
احْفَظْ اللَّهَ تَجِدْهُ أمامك، تَعَرَّفْ إلَى اللَّهِ فِي الرَّخَاءِ يَعْرِفُك فِي الشِّدَّةِ
“Be mindful of Allah, and you will find Him in front of you, acknowledge Allah in times of ease, and He will remember you in times of difficulty.”