Car Camping at rest stops may be one of the safest ways to sleep in the car. Rest stops are often lit at night and filled with people doing the same thing as you, crashing for a bit before hitting the road again. You will also find bathrooms at rest stops which are a nice little amenity.
When you arrive at the rest stop you may see signs that say something like "2 hours parking only." Generally, a sign like this can be ignored. In this situation, if anyone tries to give you a hard time you can just say "I was too tired to keep driving so I decided to pull over before I fell asleep at the wheel." This should stop them from bothering you, although the chances of someone actually saying something to you is very, very unlikely.
You will want to avoid doing any cooking or loitering outside the car while at a rest stop. That is a good way to raise some eyebrows, which is the last thing we want in this situation. Try to park far away from the spot you are going to camp at if you are going to get out of the car and rearrange stuff. Then, once everything is ready, drive to the spot you are spending the night and stay in the car.
Read the whole guide here https://every-last-rock.com/how-to-car-camp/