The tax income of the government is a percentage of the GDP, and taxes are in the end where money for investments into infrastructure and other stuff comes from.
If investments must be done regardless, it means the government has to borrow money and pay it back plus interest in the future, which again is paid for with tax money.
So if the GDP sinks, future tax income must increase to balance it - either through an increase in GDP down the road, or through higher taxes.
A reduction in GDP also means that either local consumers aren’t buying as much, or exports are shrinking, both of which are negative indicators for the local labour market and lead to layoffs.
The OP is talking about the UK though.