I find counting encounters more helpful for the tone of my campaign and its adaptability to players preferences. What counts as an encounter is normally obvious. And neutral, as it might be a noncombat encounter or a combat encounter. Whether the challenge turned out to be easy or hard is also fairly obvious. Indeed the players themselves know how difficult it was. Difficulty is a neutral metric, whether noncombat or combat.
Even for a combat encounter, counting encounters is more helpful than xp. For example, hostiles might flee, thus ending the encounter. The encounter evaluates according to how much effort it took to get them to run. Then a decision to chase after them counts as a separate encounter. Similarly, if the party captures the hostiles alive, there might be several encounters before handing the hostiles over to authorities.
Counting encounters is more open to diverse scenarios and players choices.
My difficulty with xp is it incentivizes lethal combat.
DMs can and do give xp for noncombat challenges. However the xp for combat is carefully micromanaged according to killing hostiles. In contrast, xp for noncombat feels more arbitrary and loosey-goosey to quantify. Combat is more reliable. Noncombat feels less "real" in relation to combat xp. All of this situation incentivizes combat, in the eyes of the players, and in the eyes of the DM. For example, I have never seen a DM award more xp for noncombat than for combat. Even if the noncombat challenge is far more difficult than the combat challenge, the DM routinely undervalues noncombat, because combat so tightly defines xp, and noncombat is so different.