Disciplining a 6 year old

I don’t know what to do anymore. My son goes between 3 different homes. Mine, his dads and grandmas(my ex’s mom). Because of my ex’s and myselfs crazy work schedule he usually stays with grandma on days we work. We work 6-7pm or 6-7am depending on the week, so it’s easiest if the days we work, he stays at grandmas. Grandma spoils him a lot! And so when he comes here he thinks he gets the same treatment. Meaning buying him whatever, doing whatever whenever, not cleaning up after himself, talking back... I’ve had it. I get so mad and raise my voice at him which I hate doing. I need other ways to discipline him. Maybe taking away his tablet? I need other age appropriate ideas? I’m losing my mind and feeling more and more disconnected with him because of this and it’s my fault. It hurts to feel that way.