Hello! Yes, replace them. I would check for an overhang so that water doesn’t stay. I would choose a slightly convex one.
Prime, paint twice with good paint. Be careful with end grain!
Then everything, of course, make sure it’s completely dry, use the right screws, scrape/sand the old paint, don’t keep any rotten wood! Any gaps can be sealed with paintable outdoor acrylic sealant.
Good luck!
It pays off to use quality materials as well. I wouldn't have used pressure-treated wood but good fur wood.