Romans 8:28 NKJV is familiar to many: All things work together for good. It doesn’t say that all things are good, but that they work together for good.
Think of it like a cake batter. If you eat the flour by itself ― yuck! If you eat the raw eggs by themselves ― yuck! But when the ingredients are mixed, they work together for something good when you finish the process and bake it!
We often neglect the “baking” part of the above Scripture… to those who love God, to those who are the called according to His purpose. For things to work together for good, we have to finish the process and acknowledge that God is our Source and our first love.