Precisely. A union is a cartel. It exists to restrict supply of the product they sell (labour) in order to fetch a higher price. They work just like any other cartel, for instance OPEC. Cartels benefit at the expense of everyone who is not in it. They perform rent-seeking behaviour to extract more than the product they sell is worth.
From the perspective of an economist, all cartels are bad, whether they deal in oil or labour or anything else.
From the perspective of an economist, all cartels are bad, whether they deal in oil or labour or anything else.