The Federation is said to be 8000 light years across, low estimate. That means that it would take eight years at Warp 8 (1024c) to cross it.
That was stated once in
First Contact, IIRC, but it doesn't fit other references. DS9 effectively shrank the Federation by depicting the travel time from Bajor to Earth, or from Cardassia to Qo'noS, as a matter of days instead of weeks or months. As such, the maps in
Star Trek Star Charts, and the subsequent onscreen maps based on them, have depicted the UFP as only a few hundred light years across.
Also, the published warp scales were always far, far slower than what was actually depicted onscreen, so they were effectively meaningless. For instance, "That Which Survives" claimed that the
Enterprise could travel nearly 1000 light years in less than 12 hours at warp 8.4. That's about 730,000 times the speed of light, while the published "warp factor cubed" formula would make it only 593 times. Not to mention that at that speed,
Voyager could've made it home in just over a month.
Most stated numbers in Trek are basically nonsense, because they're just space-fillers generated by different writers who have made no attempt to coordinate with each other. They're just numerical
lorem ipsum to convey a rough impression of scale or duration to the audience.