At first I couldn’t reproduce this, but found that it happens only when you use the tag-picker pane, with “show markdown formatting” off, to insert a tag into underlined text. It looks like the tag-picker tries, but fails, to turn off underlining for the tag.
A work-around is to turn off underlining with the hotkey, after placing the cursor and before entering a space and the tag. That works well to add a tag at the end of a line. When inserting a tag in the middle of underlined text, it may be affected by a general bug in text formatting, that will cause the space added in front of the tag to remain underlined, but it will still function. You can also manually type the whole tag, without clicking on the tag-picker, though that will leave the tag underlined.
In the following, I inserted the first tag without using the tag-picker, and the second with:
I turned on “show markdown” to see what was happening:
If the tag-picker is indeed trying to turn off the underlining, the markdown would have to be this instead:
It’s possible to fix the broken tag. Select the tag and its following space (but not the space in front of it), and click Underline. That will fix it, but leave it underlined. Click again to remove the underlining. You have to separately select the preceeding space to remove the underline for that. Selecting the tag and its surrounding spaces, then clicking Underline, doesn’t work as expected, it only affects the space in front - another bug. The whole process of turning formatting on and off in a line seems quite buggy.