Hazrat Shaikh Moulana Muhammad Zakariyya (rahmatullahi ‘alaih) once addressed some of his associates and mentioned the following:
I will show you the gauge to determine whether a person is among the servants whom Allah Ta‘ala has blessed with His special recognition and friendship, or whether he is merely pretending to be a pious person with the aim of misleading people.
The gauge to determine whether a person is the friend of Allah Ta‘ala is that when he associates with any person and shows mahabbah (love) for him, then his association with him is not based on any personal motive or worldly benefit. If the association is based on any personal motive or worldly benefit, then generally, when the personal motive or worldly benefit is achieved, the friendship ends. However, since his association and friendship is not based on any personal motive or worldly benefit, but rather is solely for the sake of Allah Ta‘ala, his love and friendship continues to grow and increase.
If you measure people through this gauge, then insha-Allah you will be saved from falling into misguidance and problems. Allah Ta‘ala will bless you with His special recognition and spiritual motivation. Similarly, He will also assist you divinely to find the right person to guide you in Deen.
(Qutbul Aqtaab Hazrat Shaikhul Hadith Moulana Muhammad Zakariyya (rahmatullahi ‘alaih) pg. 590)