Courts are running out of qualified judges, peers are told