I think this is easy to misunderstand in the written word, which is a great argument against Sola Scriptura

but more importantly it’s why you will see tons of very long thread debating this.
The two things that cause the most confusion IMHO are that in some places in the Bible, “works” means the procedural/legal stuff people were doing at the time of Paul, which are not relevant to salvation.
The second bigger confusion IMHO is that good works, are an effect of our faith, not a primal cause of our salvation. When the Catholic Church teaches " One is not saved by good works, but one cannot be saved without good works", it really means that the good works are the evidence of one’s faith. So while it is true that the most concise answer is that salvation comes “by faith through grace”, if you don’t have evidence of the faith through good works, then the faith is not there:
#1021 CCC: “each will be rewarded immediately after death in accordance with his works and faith” - TRUE (of course!!) - works are the measure of your faith, so both will be evident.
#2005 - We cannot therefore rely on our feelings or our works to conclude that we are justified and saved - TRUE - saying that works without faith does not save us.
#1651 - They should be encouraged to listen to the Word of God, to attend the Sacrifice of the Mass, to persevere in prayer, to contribute to works of charity and to community efforts for justice, to bring up their children in the Christian faith, to cultivate the spirit and practice of penance and thus implore, day by day, God’s grace. - TRUE - evidence of faith
#1697 - for it is by grace that we are saved and again it is by grace that our works can bear fruit for eternal life; - TRUE - even though it doesn’t mention “works”, because faith through grace saves us.
It’s very easy to misinterpret especially when relying on the written word.