This is essentially what is called “The problem of evil” in philosophy of religion which states that if God is all-knowing and all-powerful, then the existence of evil and suffering in the world proves God either does not exist or is not a benevolent being.
One way to refute this argument is to say that God allows us to make mistakes collectively and to experience the negative consequences of our mistakes (suffering) until we decide on our own to repent from our own wicked ways (2 Chronicles 7:14) and turn back to God’s ways of love, joy, and peace (Galatians 5:22). In other words bad things happen in the world because we as humans choose to ignore God’s instructions on how to live in harmony with each other as good stewards of the earth (Jeremiah 16:12, 18:12).
God does not want anyone to perish but for all to repent of our evil ways that create suffering for ourselves and those around us (2 Peter 3:9). But repentance is a choice and God is patient with humanity, knowing eventually we will repent and suffering will then come to an end (Revelation 21:4).