The Taliban pressed an offensive against the last pocket of resistance to their rule in northern Afghanistan on Friday, as prospects faded for a negotiated settlement with opposition fighters that could lead to a more inclusive coalition government.

Each side claimed that it inflicted heavy casualties as fighting raged at the mouth of the Panjshir Valley, a stronghold of anti-Taliban resistance the last time that the group ruled the country 20 years ago.

The Taliban said they pushed into the Shotul district of the southern end of the valley, overrunning checkpoints on the road and seizing a district center, according to local news reports. Ahmadullah Wasiq, a high-level Taliban leader, tweeted Friday that another district was “under attack from four directions and many areas of it have been captured.”

Resistance fighters in the Panjshir said they repelled attacks from the Taliban, who they said were forced to withdraw with heavy casualties. “At least 40 dead bodies were left behind that they could not take with them,” Fahim Dashti, spokesman for the Panjshir resistance group, was quoted as saying by Afghanistan’s Tolo News.

The Panjshir Valley has become the last holdout of resistance to the Taliban since they took power last month, as bedraggled remnants of the government’s armed forces have taken shelter there. Earlier this week, the Taliban said they had tried unsuccessfully to negotiate a peaceful handover of the province.

While the steep sides of the valley make the Panjshir easily defensible, the fighters there are virtually surrounded and unable to receive supplies from outside Afghanistan.

Senior Taliban leaders huddled to discuss the formation of a new government to succeed the U.S.-backed one they toppled last month. It is expected to include the group’s reclusive supreme leader, Mawlawi Haibatullah Akhundzada, and Mullah Abdul Ghani Baradar, a public face of the Taliban at negotiations in Doha, Qatar.

The way the United States pulled out of Afghanistan has hurt America’s image around the world, but as WSJ’s Gerald F. Seib explains, upcoming diplomatic events could allow President Biden to put the withdrawal in context. Photo illustration: Laura Kammermann The Wall Street Journal Interactive Edition

In Kabul on Friday, the Taliban were preparing for the official inauguration of their government. Thousands of white flags of the Taliban’s Islamic Emirate were being manufactured, according to footage on social media.

Western governments urged the Taliban to halt violence and take a stand in favor of protecting human rights in the country.

“There are abuses going on,” said Thomas Ruttig, co-director of the Afghanistan Analysts Network. “It’s not clear whether these are Taliban or they are people running around with guns and garb pretending to be Taliban.”

The government is also facing a growing humanitarian crisis, as swelling numbers of Afghans have appeared at the nation’s borders and found themselves unable to leave.

Among those trapped are tens of thousands of people who are eligible to resettle in the U.S. and other countries but were unable to enter the airport in Kabul before the international airlift ended.

Afghanistan’s airports have been closed, but on Friday the Taliban said a plane from the United Arab Emirates arrived in Kabul carrying humanitarian aid.

“We need to face up to the new reality in Afghanistan,” said Dominic Raab, the U.K. foreign secretary, who visited Islamabad on Friday. “No one wants to see the economic and social fabric of Afghanistan collapse.”

He said that the U.K. wasn’t recognizing the Taliban as a government but it did want a direct line of communication with the group, and wanted to channel aid through humanitarian organizations to Afghanistan.

“The Taliban has made a series of undertakings and some of them are positive at the level of words but we need to test them to see if they translate into deeds. We can’t do that unless we have at least some channel of dialogue,” said Mr. Raab.

The White House responded to a WSJ story about an Afghan interpreter for the U.S. Army, who in 2008 helped rescue then-Sen. Joe Biden and others during a snowstorm in Afghanistan. Mohammed was unable to leave the country before the U.S. exit and White House Press Secretary Jen Psaki said on Tuesday that his service would be honored. The interpreter isn’t pictured in the photo. Photo: John Silson/U.S. Department of State The Wall Street Journal Interactive Edition

The U.S. estimates that the majority of Afghan interpreters and others who had applied for visas to flee the country were left behind after August’s international evacuation effort transported more than 120,000 people from Kabul, a senior State Department official said.

During Afghanistan’s decades of war, starting with the 1979 Soviet invasion, Pakistan took in millions of refugees, but it has now refused to accept any more. Iran and the Central Asian states are also denying entry to Afghan refugees.

The United Nations has urged the neighboring states to open their borders, and for countries outside the region to take in Afghans. That is a tough sell, particularly in Europe, where anti-immigrant sentiment has been a political issue after the influx of Syrian refugees in 2015.

Write to Alan Cullison at alan.cullison@wsj.com