“He who sacrifices to any god, other than to the Lord alone, shall be utterly destroyed.
It must be remembered here that these instructions are for those who have entered into a covenant with God and are living in God’s community under His favor. They have committed to do all that God says and now He is giving them commandments that will lead to life and not death. To commit oneself to God and then worship another god is deadly and YHWH wants this made clear to those He has chosen and those who have chosen to submit to Him. He never forces Himself upon anyone; yet, He makes it perfectly clear that if you choose Him and submit to Him, He must be the only one you worship. Period. The first commandment is reiterated here.
God is jealous for His chosen, blessed ones because He knows that any other worship alternative is deadly for the worshiper. Those who worship other “gods” will naturally emulate them and take on their characteristics. God knows the deadly effects of such emulation and He graciously condemns it.