As I said, the cross referencing feature using a markdown syntax only works for Headers. This is a feature from Pandoc for internal links https://pandoc.org/MANUAL.html#internal-links
However, I remember this syntax which pandoc's Spans
You can then reference using markdown link
Subsection [My section](#mysection)
\@ref is only for LaTeX so you could not use that for HTML. This is working in bookdown only for headings, as a built in feature. So you can't have auto resolution of numbered section.
Anyway, there is no built syntax for referencing as I think you want.
The other solution would need to mix formats. You need to use specific output format features for that:
\label in PDF
id attributes in HTML that you could put on div or on span to make a link too using links.
I don't think there is any built way to do that, but there could be using a Lua filters maybe to have a common syntax for both.
Otherwise, you can make a R wrapper function for writing both syntax depending on the output rendered. See about multi format output and example about coloring word to see how that can be used.
You can also write raw code in your Markdown document, and pandoc should skip the raw code depending on the output format. Pandoc's raw inline and raw blocks are helpful for that.