How do I create a floating button on top of another app?
How do I highlight text inside the textbox of another app?
This is how Grammarly works on macOS. It seems that they use accessibility features, but I know nothing else about how to achieve this.