OK, "stole" was a strong word, but I think he was trying to copying the overall vibe and feeling of YSBIM, at least subconsciously, and a lot of the patterns on the song are similar. Obviously I don't think Paul would be so blatant as to directly make his own imitation of it, but it seems to me he was maybe trying to make his own "impression" of it.
I had read Paul wrote HTAE while waiting for John to wake up one day while he was hanging out beside the pool at John's house, sometime shortly after Pet Sounds had come out
https://en.wikipedia.org/wiki/Here,_There_and_EverywhereMcCartney began writing "Here, There and Everywhere" at Lennon's house in Weybridge, in early June
Pet Sounds came out in mid-May, of course. Plenty of time for Paul to give the album several listens.
Anyway, they both have introductions which, while different, could be said to be similar. But after that, line by line here's where I see the similarities ...
Part 1:Paul: Here, making each day of the year
--------------------------------------------------------------------
Brian: I know perfectly well I'm not where I should be
Brian: I've been very aware you've been patient with me
Here, Brian repeats the melody twice while Paul does it just once, but notice both melodies generally ascend up, "peak" in the middle of the verse and then descend back down, like a mountain. That's the main part I think is very similar. Next ....
Part 2:Paul: Changing my life with the wave of her hand || nobody can, deny that there's something there
---------------------------------------------------------------------------------------------------------------------------------
Brian: Every time we break up you bring back your love to me || and after all I've done to you how can it be?
In both cases here we have a much longer melodic line (that is actually 2 lines strung together). The first half of this (the part before my "||") the melody "peaks" on the 3rd word in both songs ("life"/"we"). In both songs after the "||" we have a melody that sort-of asks for a "resolution" ...
Now, the parts immediately after that do differ. Brain does a refrain ("You still believe in me!") while Paul goes right into the verse again. Then both songs repeat the above.
I also think the "I wanna cry!" is sort-of what like Paul used as a bridge ("I want her everywhere ..."). I'm not sure what you'd call the "I wanna cry" on the BB song but it's sort-of like a bridge anyway, maybe a bridge before the coda. These two parts are definitely different.
Imagine that Paul took Brian's first two lines, got rid of one of them, took the "I wanna cry!" and made it into a regular bridge (which is really almost like a chorus), changed the melody a bit, and - bingo! - you've got a new song.
Again, "stole" was probably a strong word. I don't even think he was probably consciously stealing/copying anything, I'm guessing it was more subconscious, more along the lines of George and "He's So Fine."
I once wrote a song that, when I played it to somebody, they told me, "That sounds like a Beatles song." I was never trying to copy anything, it was just a tune that came to me. But when they pointed that out to me, I realized, yeah, it sounded like a Beatles song (particularly Yellow Submarine). Sometimes you "copy" things without consciously intending to copy anything. IMO this is a case of that.