How do you depict fictional characters inspired by real-life people without inviting legal trouble?

Title. To a degree, I think we all stitch our characters together from our real-world interactions with real people. How do you do so legally? Tips are greatly appreciated!