Your weapon always has its Reach
There is a difference between creature's "reach" and the Reach weapon property.
Any creature capable of attacking has "reach" — a distance measured in feet. That distance can be modified in some circumstances. Basically, "reach" is "range" for melee attacks. Both are mentioned in the PHB in the combat context only:
Pick a target within your attack's range: a creature, an object, or a location.
A weapon might have the Reach property. A weapon either has it, or not. Rules as written, this property increases your attack range by 5 feet "when you attack with it":
Reach. This weapon adds 5 feet to your reach when you attack with it.
I have to say, the 5 feet are added before you make an attack. Otherwise, it would be the endless circle: you have no reach until you make an attack, but you can't attack something out of reach.
RAW, this use case is still very limited — you can not press a button 10 feet away with your weapon, for example. The errata expands it though:
This property also determines your reach for opportunity attacks with a reach weapon.
This makes me think, that rule as intended was something like "this weapon adds 5 feet to your reach when you do something with it". As a DM, I would definitely allow a character to press a button 10 feet away with a halberd.
Although, it doesn't matter in this case
Now considering a hypothetical "Halberd of Answering". The thing is, homebrew items require homebrew adjudications. The only person who can say, when the feature is triggered, is the very author of this magic item. I'd say, it should work against a foe 10 ft away, but the author can say otherwise.
As written, the weapon feature triggers when "creature deals damage", not "creature within your reach deals damage". As a result, it allows you to "make one melee attack in your reach":
In addition, while you hold the sword, you can use your reaction to make one melee attack with it against any creature in your reach that deals damage to you.
So, it should work this way:
- a creature damages you
- the weapon feature is triggered, allowing you to "make one melee attack with it against this creature in your reach"
- you make your attack
- you attack a creature up to 10 feet from you, since the Reach property "adds 5 feet to your reach when you attack with it"