What you use depends on where you use it. Inside of a match, \1 refers to what was matched by the first parens. After the match $1 refers to what was matched. In a substitution, \1 is special cased to mean $1, but that is frowned on.
Thus: /\b(\w+)\W+\1\b/ means "match repeated word".
And: /\b(\w+)\W+$1\b/ means "match word preceeded by the word matched on your last match.
Moving on: s/Hello (\w+)/Goodbye $!/ means "Replace Hello followed by a word with Goodbye followed by the same word."
And finally: s/Hello (\w+)/Goodbye \1/ is special cased to mean the same thing, but is frowned upon.
Thus: /\b(\w+)\W+\1\b/ means "match repeated word".
And: /\b(\w+)\W+$1\b/ means "match word preceeded by the word matched on your last match.
Moving on: s/Hello (\w+)/Goodbye $!/ means "Replace Hello followed by a word with Goodbye followed by the same word."
And finally: s/Hello (\w+)/Goodbye \1/ is special cased to mean the same thing, but is frowned upon.