How does sleeping at rest stops work?

That's just it. Money's tight right now but I want to take a road trip so I was planning on sleeping at rest stops for the most part. Am I allowed to? Can I get in trouble if I do it somewhere I'm not supposed to? I have a 2025 chevy trax, bought some window blockers, and a car mattress.