Jesus was teaching us to love *everyone* as our neighbor, not just the people who live next door. This is made clear in the Parable of the Good Samaritan (Luke 10:25-37).
In the parable, a man is beaten and left for dead. A priest and a Levite pass by without helping. But a Samaritan, a person from a group despised by the Jews, stops and cares for the injured man.
When Jesus asks who acted as a neighbor to the injured man, the expert in the law replies, "The one who had mercy on him." Jesus then says, "Go and do likewise."
Therefore, the parable shows that a "neighbor" is anyone who needs our help and compassion, regardless of their background or relationship to us.