First of all, I need to define neighbor, because this is the one we are to love and the one toward whom caring is to be extended. Unless we know what neighbor means, we may extend caring in basically the same manner indiscriminately—just as much to evil people as to good ones. But in that case our caring can become the opposite of caring, because although the good people will use what they have been given to do good to their neighbor, the evil people will use it to do harm.
Most people nowadays think that everyone is equally their neighbor and that we should be generous to anyone who is in need. It should be part of Christian prudence, though, to check carefully what someone’s life is really like and to extend caring accordingly. People who constitute the inner church do this with discernment and therefore intelligently; but people who constitute the outer church act indiscriminately because they are unable to make distinctions like this.
People in the church should be very aware of the different categories of the neighbor. The category to which particular neighbors belong depends on which type of goodness they have devoted their lives to. And since every type of goodness comes from the Lord, in the highest sense and to the utmost degree the Lord himself is our neighbor, and is the source [of what makes others our neighbors]. It therefore follows that people are neighbors to us to the extent that they have the Lord in themselves; and since no two people are receptive to the Lord (that is, the goodness that comes from him) in the same way, no two people are our neighbor in the same way. With respect to the particular good they do, all the people in the heavens and all good people on earth are different. It never happens that exactly the same goodness is found in any two individuals. The goodness needs to vary so that each kind of goodness can persist independently.
However, none of us can know all these distinctions and all the consequent distinct kinds of neighbor that arise in accordance with the different ways the Lord is received—that is, the way the goodness from him is received. Not even angels can know this except in a general way, by genus and species. Therefore the Lord requires no more of people in the church than that we live by what we know.-
from New Jerusalem, Sections 84-86