Heavy rain and flash flooding hit a part of southern New Mexico where two fast-moving wildfires continued to rage on Wednesday after killing two people, officials said. Although the rain will help firefighters’ efforts, the blazes were still expected to continue for several days, the authorities said.

The wildfires, named the South Fork and Salt fires, began this week amid sweltering temperatures and have prompted the evacuation of thousand of people and burned more than 23,000 acres. The South Fork fire, the larger of the two, has burned more than 16,000 acres and destroyed 1,400 structures, according to the Southwest Area Incident Management Team. About 500 of those structures were believed to be homes, Gov. Michelle Lujan Grisham said at a news conference on Wednesday night.

The New Mexico police said in a statement on Wednesday that both of the people who died had been found on Tuesday in or near the village of Ruidoso, N.M., which is between the two fires. One victim, whom the police identified as Patrick Pearson, 60, was found on the side of a road near a motel with burns, the statement said. The other victim, who was found in the driver’s seat of a burned vehicle on a road, was not immediately identified, it said.

Temperatures reached the upper 80s and 90s in Southern New Mexico on Wednesday before a storm dumped torrential rain in the Ruidoso area in the afternoon, the National Weather Service said on social media, with some areas receiving 2.5 inches of rain in a half-hour.

“Water rescues are ongoing in the Ruidoso area as flood waters surge down the slopes from nearby burn scars,” the National Weather Service said on social media on Wednesday, describing the situation as “extremely dangerous.” It declared a flash-flood emergency for Ruidoso and some surrounding areas, and issued severe thunderstorm and flood warnings for several New Mexico counties. Parts of the state will remain under flood warnings until early on Thursday.