Others have said basically this but I will add my own perspective. I think we can benefit by maintaining a distinction between these different ideas: “excommunication”, “public worthiness to receive Holy Communion”, and “not in communion with the Church.”
Excommunication is a rather rare penalty that can only be incurred or imposed in those situations detailed in canon law. I don’t know of any politician who has been excommunicated due to legislative acts. We are certainly free to think that canon law should say, for example, “anyone in a position of civil authority who formally and materially supports abortion is subject to a just penalty.” But, it doesn’t say that now and the canon on abortion does not apply to politicians and legislators (for legislating).
Excommunication as a penalty includes a prohibition on receiving the Sacraments but is more than that. It is primarily (although not exclusively) meant to correct the offender and bring him/her back to the authentic practice of the faith.
Public (un)worthiness to receive Holy Communion is a separate and distinct issue even though it meshes with excommunication in regard to reception of Communion. A person can be not excommunicated but still be clearly unfit to receive Communion (and/or some other Sacrament).
A person can do certain things or profess certain beliefs that clearly show that he/she is not thinking with the Church and/or is not a “practicing Catholic” or is “not in communion with the Church.” All the way from never attending Mass to vandalizing a statue of the Lord to tearing up a picture of the Pope on live tv to…you name it. These are all bad and can show that a person is “not in communion” with the Church.
Sometimes, “not in communion” and “excommunication” are used interchangeably, even occasionally by high ranking prelates. Nevertheless, excommunication (as a legal reality) is not the same as this “not in communion.” A person can be a “bad Catholic” and commit any number of serious sins yet still not be excommunicated. That has always been the case and always will be.
Dan