I think other answers have adequately addressed your first question; however, "I haven't been here for a long time" actually means something else. For example, the last time I was in France was in 1991. If I ever get to go to France again, I might think to myself "I haven't been here for a long time."
In other words, it means you were here before, and then you were not here for a long time, and now you are here again.
To express that you are newly arrived somewhere, you would not say "a long time." If you just moved to a city, you could say either of these:
I haven't been here long.
I haven't been here for long.
I don't know any rules to help you understand this. It's just idiomatic.