How does integration between macOS and iOS work if they are not releases from same year I just got a MacBook and it was running OS X Yosemite out of the box. My iPhone is running iOS 10. They don't integrate together very well. Then I updated my MacBook to macOS Sierra. Now they're perfect together!

If I upgrade my iPhone to iOS 12, while running macOS Sierra on my MacBook Pro, will they still work perfectly together?

Does Apple recommend to only use matching OS (macOS and iOS released in parallel in the same year)? (I'm sure they recommend to update to the latest available version but I am not ready for macOS Mojave yet).
The essential element here is the iTunes version. Older versions of iTunes sometimes play not so well (or not at all) with recent iOS versions. So if you get a new iOS version on your phone you may need to install an update of iTunes as well in order to enable your Mac and your Phone to talk to each other.