Handle booting failure for u boot

I have an external SD card available with 3 Partitions. mmcblk0 is the disk and mmcblk0p1, mmcblk0p2 and mmcblk0p3 are the 3 partitions on it.

mmcblk0p2 and mmcblk0p3, each partition has a Debian OS.

mmcblk0p2 is used as an active partition while mmcblk0p3 is used as a backup partition.

Partition mmcblk0p1 has uboot configuration. (uEnv.txt and other files that are required for booting)

I am using uEnv.txt to change the boot configuration i.e. If I want to boot from mmcblk0p3 I can give

mmcargs=setenv bootargs console=tty0 console=${console} ${optargs} ${cape_disable} ${cape_enable} root=/dev/mmcblk0p3 rootfstype=${mmcrootfstype} ${cmdline}

in the uEnv.txt

If uEnv.txt gets corrupt due to any failure or the partition is corrupt then the device won’t boot from either of the partitions. (i.e. OS)

If the uEnv.txt or active partition is corrupted then How can I boot from another partition on the reboot?