Thousands lose NHS healthcare funding after living longer than expected