yt-dlp downloads the best available format by default. However, if you use something like
yt-dlp -F [video]
you might find that it's not necessarily downloading the format with the highest resolution. This might very well be because it is unable to handle the codec of the video format in question. To fix this, install FFmpeg.
However, this might result in the "best format" being in a codec that you don't want or your device cannot support. In my case, my TV can't handle newer codecs so I need to do something like this: