The concept of “semantic similarity” is different from the concept of “textual similarity”. Semantic similarity is about the closeness in meaning of the two texts, and lexical similarity is about the lexical closeness of the two texts.
Measuring semantic similarity is very difficult for an AI (artificial intelligence) system. Progress is being made. Here’s few tutorial articles.
Advances in Semantic Textual Similarity – Google Research (2018)
Evolution of Semantic Similarity – A Survey (January 2021)

Semantic Similarity of Two Phrases
https://en.wikipedia.org/wiki/Semantic_similarity
https://towardsdatascience.com/semantic-textual-similarity-83b3ca4a840e
https://www.cs.toronto.edu/~gh/research-pages/research-semantic-distance.html
Semantic Similarity Using Transformers
How to Rank Text Content by Semantic Similarity (Semantic similarity using GloVe)
https://newscatcherapi.com/blog/ultimate-guide-to-text-similarity-with-python