Councils 'face £5.8bn funding gap'