“Nevertheless, the solid foundation of God stands firm, having this seal: ‘The Lord knows those who are His,’ and let everyone who claims the name of the Lord keep away from unrighteousness.” (2 Tim 2:19 Pickering NT)
Notice God’s “solid foundation” doesn’t mention faith. The gospel was entirely conceived and begotten by the faithfulness of the Lord (Psalm 2:7, Isa 59:16, Luke 22:42, John 6:38, Rom 5:19, 1 Cor 1:9, 2 Tim 2:13, Phil 2:8). This is the Personification of Grace. Yes, Grace has a face!!
God KNOWS (e.g. He is faithful toward) those who believe into the Lord Jesus. Therefore, our continual response to the gospel should be a mirror of His faithfulness (Gen 49:10, Matt 25:21, Rom 1:5, Eph 2:10, Tit 2:11-14). We are to depart from sin (1 Pet 1:16).
Paul is also clearly alluding to the fact that God is aware of those who wear His name in vain (which I believe is the meat of the 3rd commandment – Exo 20:7 – under the New Covenant). These folks are the ones crying “lord, lord” (Matt 7:21-22, Luke 6:46, Luke 13:25), but it ends badly!