Source: Ṣaḥīḥ al-Bukhārī 6416
Allāh's Messenger ﷺ once took hold of my shoulder, saying: "Be in this world as though a stranger or wayfarer."
Ibn Hajar's Explanation from Fath al-Bari
Al-Nawawī comments:
The meaning of the hadith is that you must not incline towards the world, or adopt it as your homeland, or tell yourself that you are to remain in it, or be any more attached to it than is a foreigner outside his country.The hadith also shows that a teacher may touch the limbs of a pupil during instruction, and that someone giving advice may do likewise, for the sake of creating intimacy and attracting his attention.