The first half of this verse, “You shall not bow down to them,” prohibits serving idols in a way we serve God, such as prostration. This phrase, “or serve them,” includes forms of service that are unique to the idol. We may not do certain things for God, but if it’s how the idol is served, it’s equally prohibited.
This mitzvah even bans serving an idol in a way that we might consider disparaging. For example, the Talmud in Sanhedrin (60b) tells us that the statue of Mercury was served by throwing stones at it, while Baal Peor was worshipped by uncovering and excreting in front of it. One might think that this gives him “plausible deniability” to disrespect these idols, but it is not so. As degrading as these acts are, one may not perform them because those were the idols’ service. (One may, however, throw stones at Baal Peor or evacuate one’s bowels in front of Mercury, as these are not the way to serve them.)
The prohibition against serving idols in their own unique fashions is found in the Talmud in Sanhedrin starting on 60b; there’s a long discussion about the service of Mercury statues in Avodah Zarah on 49b-50a. In the Mishneh Torah, this mitzvah is found in Hilchos Avodas Kochavim. It is #6 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos and #12 of the 194 negative mitzvos that can be fulfilled today as listed in the Chofetz Chaim’s Sefer HaMitzvos HaKatzar. The Ramban (Nachmanides) does not count either part of Exodus 20:5 (not to bow down to idols and not to serve them) as separate mitzvos. Instead, he includes them both under “You must not consider any other powers in My presence” (Exodus 20:3 – Mitzvah #27).
This mitzvah is binding upon both men and women in all times and in all places.