Using the optional rule from Xanathar’s Guide to Everything, this works
This optional rule states:
Most effects in the game happen in succession, following an order set by the rules or the DM. In rare cases, effects can happen at the same time, especially at the start or end of a creature’s turn. If two or more things happen at the same time on a character or monster’s turn, the person at the game table — whether player or DM — who controls that creature decides the order in which those things happen. For example, if two effects occur at the end of a player character’s turn, the player decides which of the two effects happens first.
From this, assuming it is the Ranger’s turn, we can conclude that if two effects occur at the same time, the Ranger can decide the order in which they activate. So now let’s look at the features in question.
The hail of thorns spell states (emphasis mine):
The next time you hit a creature with a ranged weapon attack before the spell ends, this spell creates a rain of thorns that sprouts from your ranged weapon or ammunition. (…)
Meanwhile, the Favored Foe feature states (emphasis mine):
When you hit a creature with an attack roll, you can call on your mystical bond with nature to mark the target as your favored enemy for 1 minute or until you lose your concentration (as if you were concentrating on a spell). (…)
Both of these features just happen on a hit (well, technically hail of thorns just happens and Favored Foe is optional, but close enough), and neither one of them require any sort of action expenditure so they can both be used (compare this to the case where two features both require a bonus action, in which case, only one could be used).
What matters now is the order is which we use them, which we can decide. If we have hail of thorns activate first, then its 5-foot radius damaging effect would occur. If we then have Favored Foe activate second, we would mark a target, thereby losing concentration on hail of thorns (concentration we didn’t really need anymore, since we had already used the effects of the spell).
Following this order of events, nothing prevents these from being used together on a single attack.