I think I have a pretty good ear for these things, and, no, McCartney’s ‘Yesterday’ is not a ripoff of the Nat King Cole song. These are not close.
This is not a “My Sweet Lord” / “He’s so Fine” situation.
This not a “Surfin USA “ / “Sweet Little Sixteen” thing.
It’s not even a Nino Rota “Godfather” ripping off “Fortunella” by.... Nino Rota.
It sounds like Yesterday repeats one line of the lyrics from the Nat King Cole song, but that’s it. The other lyrics are very different, and the melody is totally different.