(1) a neighbour who is a relative,
(2) a neighbour who is a stranger.
The Glorious Qur’an refers to the latter as al-jar al-junub. Some exegetes are of the view that it refers specifically to non-Muslim neighbours, and that we are instructed to maintain sound relations with both. The Messenger of Allah (sallallahu alayhi wa sallam) laid special emphasis on this. He said:
“That person is not a believer whose neighbour is not safe from his mischief.” The Messenger of Allah (sallallahu alayhi wa sallam) repeated this statement three times by taking an oath. A neighbour refers to a person whose house is near your own. In this narration, the Messenger of Allah (sallallahu alayhi wa sallam) did not differentiate between a Muslim and a non-Muslim. It was by virtue of these very teachings that the Ṣaḥabah (radiyallahu Anhum) used to pay particular attention to maintaining good relationships with their non-Muslim neighbours.
A goat was slaughtered at the house of ʿAbdullah ibn ʿUmar (radiyallahu anhu). When he entered his house, he asked: “Did you people send any meat to such and such Jewish neighbour of mine?” He then said: “The Messenger of Allah (sallallahu alayhi wa sallam) used to stress the maintaining of good relationships with one’s neighbours.” (Abu Dawood)
Another type of neighbour is a “temporary neighbour”. For example, the one who sits next to you when you are travelling by train, plane, bus, etc. In the verse under discussion, the Qur’an refers to him as ṣaḥib al-janb – the companion by your side. Muslims are ordered to maintain cordial relations with this neighbour as well. This order includes Muslims and non-Muslims. (Tafseer ibn Kathir) Occasions of Joy and Sorrow
Similalry, maintaining mutual and cordial relations demands that we join each other on occasions of joy and sorrow. The Messenger of Allah (sallallahu alayhi wa sallam) was mindful of this as well. If a non-Muslim fell ill, he would go to visit him. There was a Jewish youngster who used to frequent the Messenger of Allah (sallallahu alayhi wa sallam) and would serve him with love. The youngster fell ill on one occasion, so the Messenger of Allah (sallallahu alayhi wa sallam) went to visit him.
Source: The Prophet’s Relationship with Non-Muslims by Hadhrat Moulana Khalid Saifullah Rahmani