The setting: there is a race of underground people living beneath a human kingdom.
To avoid the connotations that come with ‘dwarf’, lets refer to these people as ‘molemen’ instead.
These molemen are short, stout, nearly blind, and are excellent burrowers and miners. They have evolved in an ecosystem that is completely removed the sun, their culture has no concept of the world above. They live in a vast network of deep tunnels and in extremely close-knit communities, and they have a very well-structured society.
These molemen farm lichen and mushrooms, they tender rats as livestock, and they gather roots. They harness heat from deep volcanic vents, and they draw water from underground aquifers. They are extremely proficient in tool-making and metallurgy - much more advanced than their counterparts on the surface. However, their numbers are smaller and their society is very rigid. Food is constantly limited, so the molemen live frugally.
The molemen have developed gunpowder, while the humans have not. They haven’t yet invented the musket, but the molemen are using fire lances similar to early China, as well as explosives used in mining.
For centuries, neither moleman nor human have had any knowledge of the other. The molemen shun the surface and tell horror stories about a ‘big ball of fire’ that hangs in an abyss. The humans have occasionally seen evidence of molemen (their sewage and waste expelled to the surface, for example) but have assumed that it's just some freak natural occurrence.
But then, this all changes. One of the molemen’s main tunnels is overmined and becomes structurally unstable. Above, the human’s capital city grows too large and heavy. After a series of earthquakes and tremors, the ground collapses - swallowing half the city into a pothole two hundred foot deep.
The two species are revealed to each other, and both their reactions are “Holy shit, there’s a bunch of monsters living down/up there!”
After this unpleasant first contact, conflict arises. Despite their aversion towards light, the molemen are drawn to the surface for its abundant food and supplies. The humans are drawn underground by rich veins of metal and gold.
War is declared, and the human king is very eager to crush these strange underground people.
As his advisors warn, the molemen’s tunnels are labyrinthine and they have no idea how far they stretch. It is very likely that there are tunnels beneath other cities and castles too, and there is a very serious risk of their infrastructure being undermined and collapsed from below.
Any regiments of soldiers sent below ground into the opening are at a severe disadvantage, being blind and lost. The molemen can easily ambush the soldiers in their tunnels, or collapse the tunnel and leave the soldiers trapped. The molemen have the superior weaponry, knowledge of the tunnels, and their underground defences are absolute.
Nobody knows how deep the tunnels go, but it is suspected to be hundreds of feet. The molemen are by the far better miners, and they are also fond of burying caches of gunpowder as explosive traps.
Even worse, the molemen can pop up from their tunnels anywhere, at any time, and there is no means of tracking their movements from the surface. The sun hurts their weak eyes, so the molemen often attack the surface at night.
The humans fear the molemen will collapse and overrun their nation from below.
They require a military strategy to both defend themselves and counter-attack, but how?
For answers, assume that this is a low-fantasy setting. Solutions that rely on magic are possible, but discouraged.