All of the above answers are correct. It basically comes down to what the plot requires, whether or not it makes any practical sense in actual astronomy, or even the "astronomy" of Star Trek, which takes certain liberties.
For example, the aforementioned part of "Star Trek:First Contact" has the battle against the Borg cube invading Earth just beginning while the Enterprise is patrolling the Romulan Neutral Zone). According to the excellent and handy Star Charts book, the closest area of the RNZ to Earth is about 25 light-years distant. And according to the Warp Factor Chart in the Trekpedia, even subspace signals (which move dozens of times faster than the fastest starship) take over an hour to propagate 25 ly.
Going from this information alone, the battle would probably have been over and Earth well on its way to being assimilated before Enterprise even received the subspace play-by-play that they were listening to, much less in the time it would take for Enterprise to traverse the minimum 25 ly distance. IIRC, the fastest Federation ship is the Prometheus-class, which I believe to be rated at Warp 9.99 maximum speed. Even if the Sovereign-class could match that speed, 25 ly at Warp 9.99 is 28 hours, per the Trekpedia.
Additionally, there is a line in First Contact about the Federation being composed of 150 worlds spread out over 8,000 ly. There's been numerous discussions about the interpretation of that line, but just looking at the Star Charts book, even the most simple interpretation (8,000 ly as viewed two-dimensionally, looking "down" on the maps), doesn't really hold much water. Per the Star Charts book, the Federation gerrymanders all over the goddamned place, much like a poorly drawn Congressional district. One of the farthest Federation planets from Earth, Cestus 3, is 160 ly away from Earth as the crow flies, per the maps, a journey of about 6 months at a leisurely Warp 5 or 40 days at Warp 9.
And that's not including the slight dogleg you'd need to take to avoid entering Klingon space...always a tenuous proposition depending on how the writers are feeling that week.