I read your other thread. Designing a properly working system starts with a complete specification of what “working” means.
Seems to me that you didn’t even specify what you want the system to do if one of the motors slows down. Speed it up? Slow down the other one? Some combination of these choices?
After writing down your complete specifications, you may then need to learn a little about control theory. Then learn some programming. There are plenty of resources for that both online and built into the Arduino IDE.
Then, you take a stab at writing your program. If you run into problems or it doesn’t work properly you can bring it to a forum like this one for free advice. The better you describe the way you want it to work verses the way it’s actually behaving, the better that free advice will be.
Your other option is to pay someone to write your program.