In the Chrome browser, we can select a text, then the context menu (right click) there is an option Copy link to highlight
It is possible and how to copy link or apply/remove that specific highlight on a selection range using chrome API at chrome extensions.
const selection = window.getSelection();
const range = selection.getRangeAt(0);
// chrome.highlight.add(range);
// chrome.highight.remove();