XCode already has this feature but there’s a delay on it after you single click on the text you want to highlight. You can set the delay to 0 seconds.
XCode > Preferences > TextEditing > HighlightInstancesOfSelected and set Delay to 0s
This works but I wasn’t able to change the color of it. It is a pale blue color and a bit hard to see.