one who dwells close by: a neighbor, or by extension an inhabitant of a place
The word comes from the everyday verb for settling down and dwelling, so at heart it simply means "one who dwells nearby." In daily life that is the person next door: the woman a departing Israelite asks for silver (Exodus 3:22), the household invited to share a lamb too large for one family (Exodus 12:4), the women who name Ruth's newborn (Ruth 4:17).
The same word stretches from a single household to whole peoples. Israel's "neighbors" in the Psalms are the surrounding nations, and they are rarely friendly: they mock, taunt, and gloat over Jerusalem's fall (Psalm 44:13; Psalm 79:4; Psalm 80:6). Prophets use it the same way for the peoples and towns bordering Edom or Sodom (Jeremiah 49:10; Jeremiah 49:18). So a "neighbor" here can be an ally, a rival, or an enemy: the word names nearness, not affection.
A second, quieter use drops the idea of "nearby" and means simply an inhabitant, someone who lives in a place. In the healed Zion no resident will say "I am sick" (Isaiah 33:24), and Hosea speaks of the people living in Samaria (Hosea 10:5).
This is not the warm, moral "neighbor" of "love your neighbor as yourself." That command uses a different Hebrew word, רֵעַ, which stresses a fellow member of the community. This word is more matter-of-fact: it points to whoever happens to live close by.