GET/HAVE THE BETTER or THE BEST OF someone or something means surpass, outwit, overcome, defeat, etc. someone or something, often through no fault or weakness of the person that is overcome.
“Djokovic finally got the better of Murray in a hard-fought match.”
When someone or something gains superiority, mastery, or an advantage over someone or something, they get the better of them, like your mean big sister might be always trying to get the best of you.
“That Rubik’s cube got the best of me.”
When you become superior to or master someone or something; get control of them, outdo them, win out, etc., you get the best of them. Movie heroes get the best of villains in the end all the time.
“He was determined to have the better of his competitors.”
It is often used figuratively. If an emotion or feeling gets the better of you, it is too strong for you to control and it makes you do something that you did not intend to do.
“John’s common sense got the better of his pride, and he apologized.”
If you cannot stop yourself from allowing some kind of feeling to make you do something, despite knowing that what you are doing is wrong, it gets the better of you.
“Her curiosity got the better of her and she opened the door and peeped inside.”
It can also refer to obtaining the best parts of something physical, like your mean big sister might get the better of the pie when competing with you for it.
“He got the best of the meat, I only got the brisket”.
While most sources make no distinctions between ‘the better’ and ‘the best’ in the idiom, the Oxford Advanced Learner’s Dictionary claims that ‘get the better of smb/smth’ means ‘defeat sb/sth or gain an advantage’ and ‘get/have the best of sth’ means ‘gain more advantage from sth than smb else’.