Britain has experienced its hottest July day and second hottest day on record as the mercury hit 38.1C, the Met Office said.

The highest temperature recorded on Thursday was in Cambridge, which is only the second time temperatures over 100F have been recorded in the UK, according to the Met Office. Thursday’s record temperature surpassed the previous high for the month of 36.7C (98.06F) set at Heathrow in July 2015.

Sweltering temperatures could spark thundery downpours, with a yellow warning for thunderstorms issued for most of England except the south-west, and parts of Scotland, until 4am on Friday. The storms could lead to flash flooding, disruption of train and bus services and even power cuts.

Experts at the Met Office say the current weather pattern is driving hot air from the south, but there is “no doubt” the climate crisis is playing a role in driving what could be unprecedented temperature highs.

Temperatures have now surpassed 25C for a third consecutive day in the majority of the UK, meaning the hot spell is likely to be officially classified as a heatwave. However, Northern Ireland and western Scotland have been cooler, with highs in the low 20s on Wednesday.

The government’s advisory Committee on Climate Change has warned the UK is not prepared for the increase in heatwaves that is expected with global heating.

The emergency services advised the public to take precautions in the heat and highlighted the risks of cooling off in the sea, lakes and rivers.

Insp Stuart Simpson, from the Metropolitan police’s marine unit, said: “Whilst at times the Thames may look appealing, especially in this hot weather, it remains very dangerous all year round.

“On initial entry, the water can seem warm on the surface, but further in it can be freezing cold and there are often very strong undercurrents. The initial shock of the cold water is often what leads to people going subsurface and subsequently drowning.”

The scorching weather sparked chaos on the rail network, with many operators urging passengers not to travel as many services were delayed and cancelled.

A reduced timetable in the south-east came into force at midday as Network Rail implemented speed restrictions amid fears tracks could buckle in the heat if trains travel too fast. Speed limits on most commuter lines have been reduced from 60mph to 30mph.

Network Rail’s network services director Nick King said: “There were a number of heat-related incidents across the railway on Thursday 25 July. Our teams have been working flat out to fix the issues, however we are sorry that disruption is likely to continue into the morning (Friday 26 July).”

Network Rail advised travellers to check with train operators or the National Rail Enquiries website before setting out on Friday.

The Met Office issued a yellow warning for scattered thunderstorms covering the east of the UK, from Scotland down to London, from 3pm on Thursday to early Friday morning. It said flooding and lightning strikes could affect driving conditions, disrupt train services and lead to power cuts.

Lightning over Liverpool on Tuesday night. Photograph: Peter Byrne/PA

Large swaths of the UK experienced storms and lightning strikes in the early hours of Wednesday. Warwickshire fire and rescue service sent two engines to a house in Bedworth, near Nuneaton, shortly before 2am after lightning struck an aerial.

Lightning set a roof annexe ablaze and caused a building to be evacuated at about 1.25am in Bowling Bank near Wrexham, north Wales, fire and rescue services said. The Red Cross crisis response centre tweeted that lightning during the night caused at least three fires.

Volunteers from St John Ambulance will attend hundreds of events across the country this week as the school holidays begin for most.

Dr Lynn Thomas, medical director at St John Ambulance, said: “Extreme heat can be very dangerous, particularly for the very young and old, and we would encourage everyone to check on their elderly relatives and neighbours and look after themselves this week by keeping out of the sun or covering up, wearing sunscreen and drinking plenty of water.

“Heat exhaustion and heatstroke are two of the most serious problems that can develop when the mercury soars, but by being prepared you can spot the early warning signs such as headache and dizziness.

“Knowing what action to take could mean you might be the difference between life and death in an emergency in your community.”

The NHS tweeted advice for dealing with the unusually hot temperatures. It said: “Try to avoid spending extended periods in the sun this week. Also, be aware that vulnerable people are at increased risk of health issues.”

Councils called on the public to check on family and friends, warning that elderly people and those with heart and respiratory problems were most at risk.