Here's a little bit of recreational Elisp that I wrote (a while back) that can be used to make interactive functions that work on 1) the selected region or 2) the word at point.
(defun u/funcall-with-region-fn (fn)
"Return a function that calls the given function on the currently highlighted region."
(lambda (start end)
(interactive "r")
(if (use-region-p)
(let ((query (buffer-substring start end)))
(funcall fn query)))))
(defun u/funcall-with-wap-fn (fn)
"Return a function that calls the given function on the word at point."
(lambda ()
(interactive)
(funcall fn (word-at-point))))
The idea is that you first write a simple function that works on a string and does whatever you want it to do.
Then, you make wrapped versions using the functions above.
Example:
(defun i/search-jisho-for-word (word)
(interactive "sWord: ")
(browse-url (format "https://jisho.org/search/%s" (url-hexify-string word))))
;; i/search-jisho
(defalias #'i/search-jisho (u/funcall-with-wap-fn #'i/search-jisho-for-word)
"Search jisho for the word at point.")
;; i/search-jisho-region
(defalias #'i/search-jisho-region (u/funcall-with-region-fn #'i/search-jisho-for-word)
"Search jisho for the word contained in the current region.")