There’s “works”...and then there’s “works”. :-)
In other words, the term is used differently by different speakers/writers in the Bible. We have to understand how each is using it, otherwise we won’t understand what he’s saying.
I look at what was said about separating the sheep from the goat...” When did we see you hungry., naked, poor? What you did for the least of these , you did to me. Accounts if the judgement make no references to faith alone. But I am no exegete...I would presume that loving Jesus would translate into the desire to do well by the most vulnerable in society. To me, having faith and doing nothing...would be reprehensible. I would not want to stand before my judge and say yea, well, I didn’t do any of that...but hey I believed in you...ain’t that enough?