God is with us, but we are the ones on His side. Just because He is good doesn’t mean He is good with everything we do. In Joshua chapter 5, we see that Joshua’s heart is all in but the Israelites still had wandering hearts.
God loves us and is for us but that doesn’t mean He’s always on our side. Our goal is to be on His. Stay humble, teachable and reverent before God.