LONDON—In 2010, after voters ousted Britain’s Labour Party from power, Liam Byrne , a senior treasury official, left a hand-scrawled note for his Conservative Party successor. “I’m afraid there is no money,” it read.

Now, as Labour returns to power , it inherits a similar situation to the one it left in 2010: a lack of funds to address Britain’s myriad economic and social challenges.

Like many Western countries, Britain is suffering the aftereffects of the pandemic and the war in Ukraine, which hurt the economy, drove energy prices higher and strained government finances. The departing Conservative government boosted public spending in response, raising the tax take to the highest in the postwar period and pushing debt to Britain’s highest level in six decades, according to the Institute for Fiscal Studies, a London-based think tank.

For Keir Starmer , the new prime minister , this poses a problem. Starmer spent the past two years crisscrossing the U.K. promising voters he would kick-start the economy, shore up the country’s aging infrastructure and fix an overwhelmed state-run health service, which is struggling with a backlog of millions waiting to see doctors.

On Friday, in his first speech as prime minister, Starmer reaffirmed his ambitious vision.

“Have no doubt that we will rebuild Britain, with wealth created in every community, our [health service] back on its feet facing the future, secure borders, safer streets,” he said. “And, brick by brick, we will rebuild the infrastructure of opportunity, the world-class schools and colleges, the affordable homes that I know are the ingredients of hope for working people.”

Junior doctors on strike at a picket outside UCL Hospital in London, Britain, 13 July 2023. EPA/ANDY RAIN

Doing all that without faster growth or new spending initiatives will be a challenge, especially for a party that has often relied on public spending to deliver results for voters, analysts said.

Starmer has been handed “the most rotten economic inheritance in postwar British history,” says Mujtaba Rahman , head of Europe at political-risk consulting firm Eurasia Group. “It’s going to become quite challenging for him.”

Britain’s debt has soared under both the previous Conservative and Labour governments. It is now 101% of gross domestic product, up from an average of just below 40% for the period from 1980 to 2008.

And the demands on Britain’s public finances will only grow: An aging population requires more healthcare. The U.K. is also under pressure to spend more on defense in response to Russian aggression, and on a transition away from fossil fuels. With growth weak and energy prices high, it is “a toxic mix indeed for public finances,” the IFS said in a June study.

That means the Starmer government will have to cut public services by tens of billions a year unless it wants to further raise taxes or debt, moves that may spook financial markets. “Huge decisions over the size and shape of the state will need to be taken,” the IFS said.

The U.K. has to keep a wary eye on its debt levels. Just two years ago, then-Prime Minister Liz Truss sparked a run on the pound by unveiling tax cuts that put public finances at risk. The market reaction was swift and Truss was gone in weeks.

Starmer has tried to manage expectations of what his government can achieve in the short term. “We do want change. We do want to offer hope. But we’re also trying to be realistic and honest about the legacy that this government comes in with,” Pat McFadden , a top Starmer aide, told the BBC on Friday.

Starmer, trying to shed Labour’s image as a party that taxes and spends too much, has offered only targeted tax increases to patch up the nation’s public services and is pledging to keep government debt in check. He and Rachel Reeves , the new Treasury chief, say they will build more houses, reduce immigration, fund new green-energy infrastructure and make it easier for people to get appointments in the health system.

Keir Starmer and Shadow Chancellor of the Exchequer Rachel Reeves meet with baker Paul Barlow-Heal during a campaign event at a farm in Oxfordshire, Britain, July 1, 2024. REUTERS/Phil Noble

Keir Starmer speaks next to Shadow Chancellor of the Exchequer Rachel Reeves during a Labour general election campaign event in Southampton, Britain, June 17, 2024. REUTERS/Chris J. Ratcliffe

But during the campaign, Labour already had to scale back its plans, abandoning an idea to borrow £28 billion, or $35.4 billion, to fund a British equivalent to the U.S. Inflation Reduction Act.

It is not clear how Labour will fund its promises, given that it has also pledged to reduce government debt as a percentage of national output. To be sure, it inherits from the departing Conservative Party planned spending cuts of about $26 billion between 2025 and 2027.

But the new government will have to find additional funds to cope with growing healthcare costs and extra military spending. As the number of elderly rises, and people live longer, the government will have to spend more money on healthcare just to keep service at current levels.

“Taxes will have to be raised in the medium term given the mess the public finances are in, but Labour will find it harder to break promises to leave most major taxes unchanged given their vote share,” says Rob Wood, chief economist at Pantheon Macroeconomics. Only 34% of voters backed Labour in Thursday’s election.

After 14 years in power, the Conservative Party faces its biggest election defeat ever. WSJ’s Max Colchester explains what the world can expect from Keir Starmer, Britain’s incoming prime minister.

The current problems date back more than a decade. In 2010, the Conservative government embarked on an austerity program to reduce the government deficit and debt, with the effects of those cuts still keenly felt across the country.

Local authorities cut spending on youth services and children’s centers by more than three-quarters between 2010 and 2023. The backlog of cases at the Crown Court is at its highest level on record after budgets were slashed. The prison population is close to its highest level, and criminals are being released early to make space in overcrowded jails.

Some 6.3 million people in Britain are waiting for doctors’ appointments, and it often takes hours or even days to be seen in emergency rooms. Britain’s success in diagnosing cancer cases quickly is slipping behind its peers.

Many Britons are impatient for change. The past five years marked the first parliamentary term since records began in the 1950s to see living standards decline, as inflation eroded incomes. Inflation is now coming down. But many ordinary Britons are worse off, and the economy is only growing very slowly—an average of 1.3% since 2016.

More money isn’t the only answer. Since 2019, for instance, the number of doctors and nurses has risen 20%, but the backlog of patients is still big.

Starmer has argued that the health system can be made to run more efficiently—he wants to ensure 40,000 more appointments every week during evenings and weekends, paid for by cracking down on tax avoidance. Labour will also work with private health companies to bring down the backlogs.

Starmer is also targeting structural changes, such as reforming Britain’s onerous planning regulations—which routinely block new development from housing to trains. Whether Starmer can deliver on those promises, which often face steep local opposition, will be a key test of his push for growth.

A member of the public speaks to Keir Starmer and Shadow Chancellor of the Exchequer Rachel Reeves during their visit to a Morrisons supermarket during a Labour general election campaign event in Wiltshire, Britain, June 19, 2024. REUTERS/Hannah McKay

Write to David Luhnow at david.luhnow@wsj.com and Max Colchester at Max.Colchester@wsj.com