W3C syntax rules for the targets of in-page jump links are thus:
HTML tag id and name tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). [W3C source reference]
This means that the most obvious built-in solution for a unique ID target, that of using $ID, is not valid as it is all digits. Likely most browsers will cope, but it is building on sand.
Another possible source is a user attribute of the Number type using the 'sequential' option, though note such attributes are not intrinsic.
If using either of the above, a simple workaround is to simply put a letter prefix before the numerical value. For instance:
id="x^value($ID)^"
A separate design issue is to ensure the calling link is able to use the desired target anchor value. As the user has no control over links generated via ^text^, it can mean explicitly setting the $HTMLExportFileName for all notes so as to seed the href
path of calling links so these can be post-processed to the desired version.