Keir Starmer formally resigns as UK prime minister