The Prophet ﷺ said: Allah, the Most High, continues to turn favourably towards a servant while he is engaged in prayer as long as he does not look to the side (by turning the neck), but if he does so, He turns away from him.
قَالَ رَسُولُ اللَّهِ ﷺ لاَ يَزَالُ اللَّهُ ﷻ مُقْبِلاً عَلَى الْعَبْدِ وَهُوَ فِي صَلاَتِهِ مَا لَمْ يَلْتَفِتْ فَإِذَا الْتَفَتَ انْصَرَفَ عَنْهُ