In vim you can be in a visual selection mode, perhaps selecting only parts of the text file. Normally, a substitution operation (e.g. replace string "2022" with "2023") operates on a whole line (or range of lines). To restrict this to operate only on the visual selection you have, use the "\%V" pattern at the start of your search.
So, assuming a visual selection is highlighted and within this I want to change "-" to " " :
:'<,'>s/\%V\-/ /g
A highlight containing "This-is-a-test" becomes "This is a test".
See Vim help %V