Gedit (the GNOME text editor) has a word counter plugin available on GitHub (here), but I didn’t really like it since it couldn’t display the word count of a highlighted section of your document. To do that, you would need to highlight something, and then use the Document Statistics tool from the dropdown menu. I forked the plugin and changed some code so that if anything is highlighted, it instead displays the word count of the selection. In addition, the definition of a word was changed so that words with apostrophes were counted as one and not two words.
As it was my first time doing this sort of thing, it took a while to find the appropriate documentation, but once that was done, the process went very smoothly since the changes I made were very minor. My version of the plugin is available here.