One in three councils fear funding for legal duties will run out within three years