You can be in a crowd, still you can feel lonely. Loneliness is not a physical or materialistic phenomenon. It works on a mental plane. You can be with people who are related to you, who has been with you for years but still be feeling lonely.
A person who is physically not present, who is thousands of miles away can occupy your mind and can be very close to you. In contrast, another person can be within a touching distance, even then both of you can be light years apart.
It is both ways. Some persons are like Moon who has the power to affect the oceans millions of miles away on the earth. They are the “Sin The Moon” to affect the lives of others miles away. Distance does not seem to come into their law of attraction like the Newton’s law of attraction where the attractions wanes to the tune of square distance between the objects.