The simple answer to your original question is yes both bikes will accepted the same wheels. The longer answer which you have picked up in the follow-up about rotors is that there are some nuances to compatibility.
Rotors come in a couple of sizes and the easiest set-up in terms of compatibility is to run both bikes with the same size rotor. I think you have 160mm rotors on both bikes so are good to go, but you can also easily move between 140 and 160mm rotors without messing with the wheels. You have flat mount brakes on both bikes so they are already fit with a little shim/wedge that looks something like this (
Shimano Rear Mount Adaptor Flat to Flat Road | Chain Reaction Cycles). By flipping this wedge you convert between 160 and 140mm. The wedge will be labelled with a direction to tell you which way it is installed. You are almost certainly going to have to fiddle with the brake alignment every time you move wheels between bikes. Disc brakes have a small tolerance and that means you need to align the brake and rotor every time you do a wheels slot. Adding the wedge flip to this is a trivial time difference so you can easily move between rotor sizes on a bike without changing the rotors. I honestly can't tell any difference between 140mm rotors and 160mm rotors. I have a gravel bike that accepts two different wheel sizes and I bought used wheels so the rotor sizes differ between the wheels. The time required to adjust the bike between setups is so small I haven't bothered with the cost of buying new rotors.
The thing that probably isn't compatible between the bikes is the thru-axles. There are an absolute ton of thru-axel standards and while some compatible between frames I would never assume this to be true.