Since no one else responded, I'll put in my opinion. If you are looking at a pure financial deision, keep the Sonic until it starts to rust or starts to require constant trips to a repair shop.
I looked at a 2019 CPO Malabu with @39K listed for $22K. If you get $3,500 trade in for your Sonic...