How can I find common string of characters between two pdfs?

I’m trying to find a way to compare two pdfs and find common parts of words in it. I don’t want to search word by word and I’m totally fine with trying to write a script or something that would help me do this. I want something that find common words, or words that are closely similar.

Also, I could use a different type of document if it’s simpler.

Thank you