The UK is to get its seventh prime minister in less than 10 years, after Keir Starmer confirmed he is to step down.