Remove the rotten wood and bowing planks and replace. When reconstructing the railing, be sure to follow local building code so children can't get through or stuck. How big is the deck?
In addition to Naomie’s advice, once you replace the bad wood seal the entire deck with a good water sealer such as Thompson’s Water Seal.
Lever up or unscrew, all the dodgy timbers on the deck and replace with new!
The same principle is used with the railings, or completely replace them. Maybe use metal this time or PVC. Best wishes.
We carefully removed the damaged pieces and replaced them, then cleaned the rest and sealed the entire thing.
This article might help with the railings: https://www.todayshomeowner.com/video/how-to-stop-rust-when-painting-wrought-iron-railings/