A hotly debated labor-backed bill codifying a California Supreme Court decision that makes it harder for employers to classify workers as independent contractors passed the state Assembly.

The debate over who is an employee and who is an independent contractor comes amid the growth of the gig economy and companies like Uber Technologies Inc., Lyft Inc., and Postmates Inc. that offer work through digital marketplaces. Independent contractors lack many of the workplace protections and benefits available to many workers classified as employees.

The legislation would effectively codify into state law the California Supreme Court’s ruling from last year...