What exactly constitutes “using” an ability for an attack?

I was having trouble finding a clarification on what exactly an ability needs to apply to to be "used" in an attack. Just for example, would a magic longsword that lets you add your wisdom modifier to your attack and damage on top of your strength mod "use" both wisdom and strength? Or what if the bonus is to only one of attack or damage but not both, is that still "using" the ability for that attack? The ranger’s Foe Slayer feature might be an example of the latter case, I think.