It depends on the brand and the size.
For example Shimano callipers won’t work with Avid 185mm rotors, because shimano made them for 180mm rotors. Even with the same (shimano 180mm or avid 185mm) addapters. But they do work with the 160mm rotors (and no addapter on the front and the same addapter on the rear).
As long as the outside diameter matches it should work (otherwise it’ll wear out the pad leaving a lip at the top where it doesn’t touch it), the inside diameter isn’t critical as the arms will sweep the pad and wear them, plenty of designs do this deliberately to clear dirt).
If the rotor is larger than nececary then you can make it work by adding IS calliper shims to the post mount bolts to move the calliper out by 1-3mm untill it just clears the disk. If the rotor is a few mm too small there’s not much you can do.