What happens when you try to unlock/open the liftgate? Do you get 3 beeps? If so, check the fuse for the power liftgate to make sure is hasn't blown. If the fuse is good, follow the process outlined in the owner's manual to manually open the liftgate. When you have it open, manually close the liftgate, then start the car and see if the liftgate will open.
Personally, when I blew my own liftgate fuse the first time (2018 CX-9), I spoke with a Mazda tech. He advised that on the 2016+ CX-9, if the liftgate won't open and the fuse is still good, we should disconnect the negative battery terminal and depress the brake pedal for 1-2 minutes to ensure that all electricity is discharged, which forces most of the electronic modules to reset. Reconnect the negative terminal, then ensure all doors are unlocked, and attempt to open the liftgate using one of the switches. If it still doesn't work, open the liftgate manually from the inside, then close it, and try again. If that doesn't work either, it should be brought to the dealer. This process should be the same for the CX-5.
If none of the above works, before bringing it to the dealer, you can try having the new battery load tested for free at an auto parts store to make sure it isn't defective. A defective/low voltage battery can cause weird electrical issues.
Fuse location (#16 in passenger compartment, 20A):
Fuse box diagram (location and assignment of electrical fuses) for Mazda CX-5 (CX5) (2017, 2018, 2019, 2020-, 2021, 2022, 2023)
fuse-box.info
"When the Liftgate Cannot be Opened" procedure in Owner's Manual:
Good luck!