Sometimes someone gives us advice, and we think "Easy for you to say". When someone tells us not worry about problems we are facing and they have things seemingly going well in their own life, we think that they just don't understand. We need to know where Paul is writing: "Rejoice in the LORD always". He is writing from a prison cell. He is able to rejoice in the face of imminent execution. He says don't be anxious about anything. If anyone had a reason to be anxious it would be a man sitting in the prison cell who woke up every morning with uncertainty if he would make until bedtime that night.
He doesn't just tell us to rejoice or not be anxious. This doesn't come from inspirational posters or the power of positive thinking. How can we both rejoice always and not be overcome by anxiety? By putting our whole lives into God's hands through prayer and petition. Paul was able to handle the troubles he was facing by realizing that God was ultimately in control. He had hope that no matter what people did to him here it would not take him away from the love of God.
The prayers led to a "peace of God which transcends all understanding". How often does God's peace not make sense in the circumstances we face. How can I have peace in sickness, loss, or betrayal? Because we know it is not up to us to handle or fix on our own, but rather we rely on God who is more powerful than any challenge we face, and loves us more than we will ever fully understand.