Isaiah 10:5-19 is directed against the Assyrian king and his army. God was using this ungodly king to punish Israel and Judah for their idolatry and social injustice. But this king and his army were themselves guilty of the same things, and worse. And, through Isaiah, God pronounced his judgement on Assyria as well. Even though God uses the ungodly, like this king, he does hold them accountable for their own free actions.
When the Lord has finished all his work against Mount Zion and Jerusalem, he will say, “I will punish the king of Assyria for the willful pride of his heart and the haughty look in his eyes.Isaiah 10:12 NIV
God is Sovereign
While we are long removed from ancient Assyria and have nothing to fear from them any longer, the principle expressed here is still relevant. God is sovereign. And he will use anyone and everyone to accomplish his sovereign purpose for humanity. Even the most ungodly leader we might be able to identify is still being used by God. Even those who totally reject God and are pursuing their own agenda.
It is generally not clear to us how God is using them. But it is comforting to know that God is in control. And that I can trust him, even when I do not understand, or see a way out of the circumstances I find myself in. God used the king of Assyria to punish Israel, leading to their eventual purification. And God will use the challenges we face to refine and purify us and our faith (1 Pet. 1:6-9).
Another comforting thought is that these ungodly people will be held accountable for their actions. Even though God uses the ungodly to accomplish his purpose, they are still accountable. He is not forcing them to do what they do. And so, in the end, they will have to answer to their creator, and suffer the consequences of their actions.