The consequences for Israelite’s disobedience were dire. But if they confessed and if their hearts were humbled, then God remembered and kept his covenant with them (see Leviticus 26).
If we confess our sins, he is faithful and just to forgive us our sins and to cleanse us from all unrighteousness (1 John 1:9).