doesnt need to be the same OS version.. currently my iphone is on iOS 27 beta and apple watch is on 26.6.
you can update and run a higher version iOS on your iPhone vs your watch, but no vice versa.
for example. if your phone and watch are both currently on 26, if you try to update your watch to watchOS 27, it will prompt you to update your phone iOS to 27 first. and if you proceed to update your phone iOS to 27, you can still continue to use your watch on watchOS 26 if you choose to.