Government borrowing was £22.9bn last month, the second-highest June borrowing since monthly records began in 1993.
The Office for National Statistics said that borrowing was £4.1bn more in June than the same month a year ago.
Interest payments increased by £10.3bn compared to this time last year, reaching a total of £19.4bn in June alone.
The ONS said the jump in debt costs was due to a big April increase in the retail price index gauge of inflation – the benchmark for index-linked government bonds.
Chancellor Nadhim Zahawi said: “We recognise that there are risks to the public finances including from inflation, with debt interest costs in June more than double the previous monthly record.
“That’s why the government has taken action to strengthen the public finances, and in their latest forecast the OBR (Office for Budget Responsibility) assessed that we are on track to get debt down.”
In the first three months of the 2022-23 financial year – which started in April – Britain has borrowed £55.4bn.
This is actually £5.7bn less than the same time last year, but it is also roughly £3.6bn more than forecasts made in March by the Office for Budget Responsibility.
Ruth Gregory, senior UK economist at Capital Economics, said: “This may limit the ability of the next prime minister to provide more relief for households when a further rise in CPI inflation from 9.4% in June to around 12% in October worsens the cost of living crisis.”
Tax and spending policies have been among the big issues debated by the two remaining candidates to replace Boris Johnson as prime minister.
Foreign Secretary Liz Truss says she will cut tax immediately but former chancellor Rishi Sunak has warned this could fuel inflation.
Hoa Duong, economist at PwC, said the UK’s estimated borrowing stands at around 12.4% of GDP, adding: “This is much higher than the 50-year average of 3.6%, meaning encouraging growth is the key to sustainable public finances strategy.
“While tax cuts could ease business cost pressure and encourage growth, this could push up inflation, exacerbating the current pay squeeze.
“At present this means a choice between focusing on managing the deficit or tackling the cost of living rises, but not both.”