Here is an explanation of the verse at Proverbs 31:9...
If you read the surrounding verses you will find that regarding the welfare of her son, Lemuel's mother was advising him. She characterizes promiscuous conduct as “what leads to wiping out kings.”—Proverbs 31:3. Excessive drinking is not to be overlooked. “It is not for kings, O Lemuel, it is not for kings to drink wine,” she warns. How is a king to render sound and clear-headed judgment and not “forget what is decreed and pervert the cause of any of the sons of affliction” if he is constantly intoxicated?—Proverbs 31:4-7. On the contrary, by remaining free from such vices, the king will be able to “judge righteously and plead the cause of the afflicted one and the poor one.”—Proverbs 31:8, 9. Kings and government rulers were and are to render judgement....Jehovah God allows this for the time being so as to have a measure of safety for the human family.
Romans 13:4
"for it is God’s minister to you for your good. But if you are doing what is bad, be in fear, for it is not without purpose that it bears the sword. It is God’s minister, an avenger to express wrath against the one practicing what is bad."