Yes, knowing your neighbors is a must and to that I would add making yourself useful either through things you do or things you know can result in you being perceived as an asset to the neighborhood rather than a liability. This is perhaps easier in small town or rural settings where being anonymous is very difficult to do. It is probably also easier for extroverts than introverts. Regardless of where you live or your personality type, just making it a point to smile and say hello to everyone you see in your neighborhood or building will get the process started. If you look for opportunities to be helpful, you’ll see them. They’re there.
The issues of water, heat, and food (and I would throw in sanitation) in apartments is a tough one perhaps but as Selco points out, there are options if you think through your specific situation. To the extent you have thought things through you can make yourself a valued asset by guiding others who live in your building/neighborhood when the SHTF.