Confidence in the Commons is the central principle
The UK government must be able to command the confidence of the House of Commons. Confidence can become explicit through a designated vote or be tested through circumstances that make the government's ability to govern untenable.
Because the UK constitution is not contained in a single codified document, conventions and parliamentary practice matter alongside statute.
A prime minister can change without a general election
The electorate chooses members of Parliament rather than directly electing a prime minister. A governing party can therefore change leader during a Parliament, with the new leader becoming prime minister if able to command Commons confidence.
That distinction explains why a change at Downing Street does not automatically require a nationwide vote.
Elections remain the ultimate reset of parliamentary arithmetic
A general election determines the composition of the Commons and therefore which government can command its confidence. The statutory framework now again allows the prime minister to request dissolution, with constitutional conventions surrounding the monarch's role.
The practical constraint on any government is thus parliamentary arithmetic as well as public opinion.