Warnings of severe thunderstorms are in place across much of the UK after some areas saw the longest stretch of high temperatures since the 1960s.
An amber storm warning has been issued for most of Wales, the West Midlands and parts of the North West.
Flooding, damage to buildings, travel disruption and power cuts are expected in those regions.
A yellow storm warning – meaning there is a small chance of flooding and travel disruption – has been issued for the rest of Wales and most of England for Wednesday night, and extends to more of the East and South East and most of Northern Ireland on Thursday.
The yellow warning applies for Wales and the majority of England until Monday night next week.
The Met Office also warned of potential damage to buildings from lightning strikes or strong winds, and 30 to 40mm of rain falling in less than an hour in some places.
Forecaster Greg Dewhurst said the high temperatures triggering the thunderstorms could cause flooding.
“If rain is falling on places that have been quite hot and dry, and the ground is quite hard, the rain doesn’t have anywhere to go, and from that we can see flash flooding,” he added.
Thunderstorms are expected to clear overnight, while temperatures could remain above 20C, he said.
“It’s still going to be warm and humid and that could then trigger some thunderstorms across parts of England and Wales through the afternoon and evening [on Thursday],” he added.
“Generally, the rest of the week remains unsettled with showers, some of them thundery and heavy, but there will still be some warm, sunny spells at times too.”
“It’s not often we get temperatures this high over several days, and that is triggering thunderstorms across parts of England and Wales.”
Three people died after a passenger train derailed near Stonehaven in Aberdeenshire. It is thought the train hit a landslide after heavy rain and thunderstorms.
A major incident was also declared in Fife.
The Scottish Fire and Rescue Service said it received more than 1,000 emergency calls on Tuesday night due to the severe weather.
The Environment Agency said 10 properties in Lancashire were also affected by flooding following storms.
It has issued flood alerts for certain areas in England and Scotland, which are separate from the weather warnings issued by the Met Office.
The warnings and alerts follow scorching temperatures in the UK.
The Met Office said temperatures surpassed 34C in central London for the sixth day in a row – the first time that has happened since at least 1961.
St James’s Park in the city saw a high of 34.6C.
Devon and Cornwall Police warned the south west of England is “full to capacity”, leading to “unprecedented demand” for 999 services.
The force said it saw an increase in anti-social behaviour and public order offences on Saturday and Sunday.
Assistant Chief Constable Jim Colwell said the weekend’s events, spurred on by the hot weather, had forced officers to attend a “plethora of different incidents”.
And in Sussex, more homeowners had water supplies cut off or restricted on Wednesday. At least 300 householders had already been without tap water since Friday.
Steve Andrews, head of central operations for South East Water, said more than 150 million litres of extra water were being pumped into the network as the UK heatwave continues.