Lot leaving Sodom with his family by UrruchiKing Nebuchadnezzar had told Nebuzaradan to find Jeremiah. "See that he ism't hurt," he had said. "Look after him well, and give him anything he wants." Jeremiah 39:11-12
So you see, the Lord knows how to rescue godly people from their trials, even while punishing the wicked right up until the day of judgment. II Peter 2:9
I find these verses comforting. The first is an irony. Why would strangers and pagans treat Jeremiah better than the "people of God?" Jeremiah had been imprisoned by the leaders of Judah for his unpopular prophesies. God uses the Babylonian ruler to get him out of prison and into a better situation. It shows how God always knows how to get something done, if by a way only He might use. Jeremiah's faith is rewarded and is given a reprieve.
The second passage, II Peter, refers to Lot, who in my mind is shown to be somewhat inactive in his faith in Genesis. But God noticed his displeasure in the prevailing morality and protected him from the destructive judgment cast on Sodom and Gomorrah.
I feel that this can be legitimately expanded to imply that God knows how to do all sorts of things we humans can't figure out. I used to take this verse with me when visiting a hospital for followup appointments after an auto accident. I gave it to hospital staff because it can be a comfort to reckon that God can transcend science and our expectations and do whatever needs to be done, because He always knows how.