Guilds and unions are both organizations that benefit interest groups, but they do it in different ways. The marxist phrasing would be that they arose as responses to different material conditions and so do their business differently.
In particular, guilds are a pre-socialist phenomenon – they’re old as balls.
The primary difference seen from a really simple overview is that if you’re employed in 1478, you and your boss are in the same guild (if your field has a guild). If you’re employed in 1978, you and your boss are not in the same union.
This is because in 1478, the “interest group” is cobblers and shoemakers, and the guild works to keep things as profitable as possible for people who work in the shoe business – import bans on foreign shoes, quality inspections so the public prestige of shoes don’t drop and they don’t being demanding cheaper shoes, limits on how many shoes are made by each cobbler so the cobbler across town also has a chance to sell some.
And in 1978, the “interest group” is laborers (not bosses) employed in manufacturing because class analysis told socialists that these two groups of people, despite both being in the manufacturing business, have very different interests and cannot both be adequately represented by the same organization.
But you cannot tell a guild from a labor union by counting whether any bosses are in the organization, because that’s not the important part, the important part is whether the organization is set up to protect labor or if it is set up to protect members of an industry. E.g. the Screen Actors Guild, which I have been calling “not a union” for a while, is not set up to protect people who labor in the film industry. One of the ways you can tell is that it’s set up so that it is hard for labor to join. Another is the way it’s built so that SAC wages depend on how close you are to one specific place in California. SAC is not an organization that protects labor in the film industry, it is an organization that protects the wealth of Hollywood interests. It’s the Hollywood Film Guild, not the Film Labor Union.
(And when it was created, it was indeed to address the complaints of labor.
And today it’s SAG-AFTRA but eh. Analysis more or less the same.)
But disregarding specifically SAG and returning to guilds/unions – they’re both organizations that make an industry more profitable for the organizations members by manipulating money through cartelization. Guilds: – “we all agree not to sell shoes for less than $XX per pair,” – and Unions: – “we all agree not to produce shoes for less than $YY per hour.” But they’ll both lobby to keep the tariff on foreign non-guild non-union shoes high so you’ll have to buy from them, at their price, rather than competition from somewhere else they cannot influence.