I follow these steps to stop bike disc brakes from rubbing:
1. Spin the wheel and identify which brake pad is rubbing.
2. Loosen the caliper mounting bolts.
3. Squeeze the brake lever to center the caliper, then retighten the bolts evenly.
4. Check clearance between the rotor and brake pads.
5. Repeat adjustments if needed, ensuring even pad-to-rotor spacing.
6. Take a test ride to confirm that the rubbing is eliminated.
You can find more info here https://www.bikertricks.com/disc-brakes-rubbing/ if interested.
Hopefully, this guide will also be helpful for you.