Pre-war, Britain was considered the stronger power. During the war, Russia lost over 20 million people and had about a fifth of its landmass ravaged by scorched earth policies, first by the retreating red army and later by the Wehrmacht. Britain's losses weren't anywhere near the Soviet Union's, and yet it was the latter that came out of the war a superpower, while Britain was bankrupt and with reduced wealth. What accounts for this?
As of 1945, Britain, US, and USSR are all considered to be superpowers by modern day understanding. The US was the most powerful, though, because it was left mostly untouched by both world wars. Britain, however, very quickly fell off compared to the other two mostly due to the effects of decolonization.
We should consider Britain's colonies in two general categories: settler colonies and resource exploitation colonies. The former include Canada, Australia, New Zealand, and South Africa (SA wasn't majority settler, but its government was dominated by them). The latter include the others, notably India.
By WWI, the settler colonies had already started developing their own identities and had been given some level of autonomy by Britain. Canada became a partially autonomous confederation in 1867. The dominions (e.g. Canada, Australia, New Zealand, etc.) of the empire became legislatively independent in 1931 after the passing of the Statute of Westminster. These territories also gained their own identities by this time. For example, the Galipoli campaign helped galvanize Australian and New Zealander identities separate from Britain. After WWII, these territories were all legislatively independent (e.g. NZ was the last to pass Westminster in 1947), though the UK could still pass laws to affect these territories until the 80s when "patriation" acts were passed. With the "loss" of the dominions, Britain's population and economic potential dropped significantly, which instantly put it a level below the US and USSR.
The loss of the other colonies also hit Britain. India was the "jewel" of the Empire. In 1947, the Raj was ended, which was another huge hit to the Empire. It was especially important because a huge part of Britain's imperial policy in the 19th century was to gain territories to protect India and lines of communications to it. This is a predominant reason why they claimed the "Cape to Cairo" territories, Egypt specifically (Suez Canal), and territories along the Persian Gulf.
Losing India made many of these territories unnecessary. Additionally, there was the rise of anti-imperialism in general that challenged British colonial control in Africa and the Middle East after the independence of India, though most of them became independent in the 60s or 70s.
In all, immediately after the war, with the dominions still closely tied to Britain, Britain and the USSR were both considered superpowers. Decolonization hit Britain hard, which by 1947 (basically before the start of the "postwar era") had reduced it to a power lesser than the US and USSR.