Firefox 131 released in October 2024 gained the ability to link to a specific text fragment inside a web page by including #:~:text= followed by the text fragment to link to.

But, that feature is turned off by default. To turn on this feature, first go to your about:congfig page and click through the warning. Then search for fragment in the search box.

Firefox fragment search in about:config

To turn on this feature, make sure dom.text_fragments.create_text_fragment.enabled is set to true (as shown above).

Once that is done, a right-click contextual menu, Copy Link to Highlight, is now available from within any web page.

webpage with right-click Copy text to Highlight command available for linking to a text fragment within that web page