BAKHMUT, Ukraine—After spending several hours sheltering from Russian shelling in his basement, Yuri Vyshchepanko and his wife came up to the kitchen to get some water on Tuesday, and to call their daughter to say they are safe. That’s when the house shook.

“Smoke everywhere, stink, darkness, we thought we’re on fire,” Mr. Vyshchepanko recalled an hour later as he was treated for moderate burns and cuts. He and his wife are lucky to still be alive. According to rescue workers, the Russian rocket that slammed into their home and punched through their ceiling failed to detonate.

Ukrainian soldiers repair a tank after it was hit by a Russian drone on the front line around Bakhmut, Ukraine.

Photo: Manu Brabo for The Wall Street Journal

Others aren’t as fortunate. Russian artillery shells and rockets constantly rain on Bakhmut these days, destroying bit by bit a once elegant Ukrainian town of 72,000 people that used to be famous for its sparkling wines—and now is finding itself as the primary target of Moscow’s offensive in the eastern Donbas region.

Russian forces started pushing toward Bakhmut more than a month ago, after seizing the towns of Severodonetsk and Lysychansk 30 miles northeast of here, in Moscow’s last significant gain in Donbas. Since then, Ukrainian forces have been holding the line, with heavy fighting every day east of the road connecting Bakhmut to the town of Siversk to the north.

Despite preparations for a possible Ukrainian counteroffensive in the southern Kherson region, the war’s main effort for now continues in the Donbas. Roads are clogged with Ukrainian military traffic as fresh heavy weapons, troops and ammunition pour in. The 20-mile front line from Bakhmut to Siversk is a constant sequence of plumes rising from artillery hits and the fires they cause.

“We have stopped the Russians here, and they aren’t able to advance,” said a Ukrainian artillery captain. “It’s hard, there are losses, everything around here is smashed up by artillery. They still have an advantage in firepower, but not for long because they are running out of steam,” he said. “They have more quantity, but we have better precision.”

Minutes later, a 122 mm howitzer under his command, operating off a feed supplied by Ukrainian drones, fired at a Russian infantry unit that had been spotted as it tried to push forward. The unit turned around. The Russians also have plenty of drones in the air: Earlier that morning, a suspected Russian kamikaze drone slammed into a tank in the captain’s unit, damaging its machine gun but leaving the rest largely intact. The tank, used as an artillery piece, was expected to resume operations later in the day.

The Russian way of war here, as in other Donbas cities that Russia captured since February, such as Popasna, Mariupol or Severodonetsk, consists of indiscriminate shelling that makes these urban areas uninhabitable and eventually indefensible.

“They try to crush and crush with artillery, without having particularly talented commanders or great successes in modern tactics. They just keep using old Soviet manuals, and the only thing that is effective in them is this use of artillery fire barrages,” said Col. Serhiy Cherevatyi of the Ukrainian military’s Eastern Command that oversees the Donbas campaign.

Aware of the wholesale destruction and the large civilian casualties wherever Russian forces approach, Ukrainian authorities have repeatedly urged all inhabitants of Ukrainian-controlled Donbas—and in particular front-line cities such as Bakhmut—to move to safer parts of the country. Some 20,000 residents still remain in the city, said Maryna Ivanushkina, the Bakhmut municipality official in charge of evacuations. While Russia and its proxies seized roughly one-third of Donbas in 2014, and then another third this year, Ukraine still controls a chunk of Donbas about the size of Lebanon.

A Ukrainian armored vehicle in Siversk, Ukraine, where much of the heavy fighting takes place every day.

Ukrainian civilians have been evacuated from Bakhmut, but some 20,000 remain in the city.

“We are actively trying to convince everyone to leave the city because we understand that the fall and the winter will be very difficult,” Ms. Ivanushkina said as she checked two minibuses packed with civilians abandoning their hometown. “There will be no heating, and continuing active combat means that there may not be any power, water and telecommunications either. The most important thing for people here should be to save their lives in other, safer, places.”

In one of the minibuses, Maria Petryshyna, 72, said she had no idea where she was heading. “Anywhere. I just want to get as far away as possible from here. It is too loud at night, impossible to sleep anymore. The hole in our apartment building, on the second floor, is bigger than my height,” she said.

Bidding goodbye to their daughter and two grandchildren in the second minibus were a couple who already fled the city of Horlivka in 2014, and moved to Bakhmut from an area closer to Lysychansk in May. “Tanya, please make sure to call,” the mother called out. “Mom, mom, don’t cry,” the daughter shouted back.

While some Bakhmut grocery shops and pharmacies are still open, life in the city is quickly fizzling away, with essential services beginning to collapse and the few coffee and fast-food shops that were opened weeks ago now boarded up. Streets are blocked off with concrete blocks. The eastern edge of Bakhmut, past a giant winery where sparkling wine is fermented in a former gypsum mine, looks deserted because of its proximity to Russian lines and more frequent shelling. While Russian media has reported the area to have been seized by the Wagner Russian mercenary group, it remains, for now at least, under Ukrainian control. Fighting is so far from the city that no gunfire can be heard, even at night.

“The enemy is trying to sow panic and chaos in the city as much as it can. And now that the Russians are closer and can hit it with field artillery, more and more civilians are brought here every day,” said surgeon Dmytro Androshchuk, medical chief of the Hospitaller Battalion that helps operate the area’s only remaining medical facility.

Most civilian doctors escaped Bakhmut long ago, and the regular military hospital also evacuated last month. That has left a team made up of Hospitallers—medical volunteers attached to the Ukrainian army—and medical staff seconded from three Ukrainian army brigades defending Bakhmut, to treat and stabilize the wounded before they are transferred to fully functional hospitals further west.

The recent deployment of fresh Ukrainian artillery units has led to a fall in casualties coming in, Dr. Androshchuk said. “When our artillery is working, we have less work,” he said. “There used to be days when we didn’t have time to eat and slept only three to four hours a night, with 10 to 15 casualties coming in at a time. Now, sometimes we manage to get a full night’s sleep with just the emergency shift managing the flow.”

Almost all the casualties, military and civilian, coming this week arrived with shrapnel wounds and contusions. Some needed minor patching up, others had more serious wounds. A few were dead on arrival.

Russia’s use of cluster munitions to hit residential neighborhoods has become commonplace here, Dr. Androshchuk said. These weapons, with their characteristic tac-tac-tac sound of cluster bomblets going off in a sequence, are far from precise.

On Monday morning, Volodymyr Skuban was picking spring onions on a small vegetable patch that he owns near a drab apartment bloc where he lives west of Bakhmut. One Russian rocket with cluster bomblets slammed into a wall behind the building, and another somewhere in the overgrown area behind. Mr. Skuban, hit in his knee and bleeding out, crawled through the vegetation for about an hour until neighbors spotted him and, stepping carefully so as not to trigger another explosion, tried to stop the bleeding and called in the ambulance. He got to Dr. Androshchuk in time.

One of these neighbors said the experience of the recent months has made him change his once favorable views of Russia and President Vladimir Putin. “In January, I would have voted for Putin with both of my hands,” he said. “Now, I just want to cut off every one of his fingers, one by one, slowly.  So many people have died because of what he has done.”

There are, however, others in Bakhmut—particularly among the minority that remains in the city—who hope for Russia to take it over. Several locals have been detained for actively collaborating with Russian troops, officials said.

“Not everyone is for Ukraine here. Some will go and report you later to the Russians,” whispered one woman as she stood outside one of the open grocery shops waiting for her turn to come inside. “Those are the real scoundrels. In the morning they come and get welfare payments from the Ukrainian state, and in the evening they guide Russian fire onto the city.”

Many other remaining civilians profess their disinterest in politics. Vyacheslav Reznitsky, a former miner, said he is staying in Bakhmut because all his family wealth is tied up in a handful of properties that he can’t afford to lose. “At this point I don’t care who wins. These houses are all we have, and all I want is peace and so I can live my life again,” Mr. Reznitsky said as he sat with his dog in a housing block near Bakhmut’s winery, oblivious to the shelling that was getting closer and closer.

Stretchers drying outside a medical facility in the Bakhmut area.

Wounded soldiers are stabilized in the Bakhmut area before being transferred to medical facilities further west.

Judging by the amount of destruction already inflicted on Siversk, a smaller town on the northern end of the front line, the odds of Mr. Reznitsky’s properties surviving the battle for Bakhmut intact aren’t particularly high.

Hardly any structure in Siversk has remained undamaged. Russian troops claimed to have seized the town at least three times in the past month, but still remain miles away. Cows that have gone feral roam the town’s streets, many made impassable by craters from explosions. A few dozen elderly residents live in the basement of the local hospital, where the one remaining staff member, Valery Butko, provides some basic care and food is supplied by volunteers.

With electricity long gone, a fire burned outside, warming up a pot of food. “We’re alive, for now, but they hit us from all sides,” Mr. Butko said. “There are other people left in the city, too, but you can’t see them in the streets because they are hiding in basements. This is the kind of life we have here—life underground.”

Taking advantage of a lull in the shelling, Anatoly Petrovych slowly walked past what used to be Siversk’s school, half of it collapsed. At 78, he said he was too old to contemplate leaving his hometown. He complained that he hadn’t tasted bread in weeks and then pointed to a giant hole scooped out by a Russian shell in the side of a three-story apartment block, with pieces of a bedroom and bathroom on the other side. “Last month, a family was there, sleeping at night,” he said. “And then, in one second, they were all gone.”

Write to Yaroslav Trofimov at yaroslav.trofimov@wsj.com