Meaning of “have the best of both worlds” - Learner’s Dictionary

have the best of both worlds

to have the advantages of two different situations:

Living in the country and working in the city you have the best of both worlds.

(Definition of “have the best of both worlds” from the Cambridge Learner’s Dictionary © Cambridge University Press)