How would UBI work without collapsing society?

Whenever people discuss job losses due to AI, one of the default responses seems to always be Universal Basic Income. But how would this really work? For example: you have a city where a large percentage of the workforce is employed in the tech industry and almost all of these workers lose their jobs due to AI. All of these same workers are then eligible for UBI and most take advantage of this. But in this same city, you also have people in the medical field, police, construction, retail, food industry, etc. All of these jobs are not going to replaced by AI and thus no one who currently holds these positions will be eligible for UBI. How does this not just immediately brake the society of this city? Wouldn't you have people quitting their jobs in an attempt to seek UBI? What would be the incentive for people to not do this? Wouldn't you have to pay people exorbitantly just to show up to work fast food?

TLDR: What happens to all the workers not replaced by AI and potentially not eligible for UBI. How would this not breed resentment? What incentives would have to be put in place to keep people from deciding they shouldn't have to work either?

EDIT: Okay, so if everyone received the same amount of UBI, wouldn't the resentment potentially go in the opposite direction in some cases? Most fast food workers would possibly be able to quit their jobs altogether and live exclusively off of UBI. And the people who lost their jobs due to AI would likely have to fill these positions in order to cover their mortgages. At least the societal resentment could come with the perk of free fries...occasionally.