A crate is a den, not a cage, if it's introduced properly. Most dogs come to treat one as their own space and take themselves off to it. Getting the size right and the introduction right is what makes the difference.
How to measure
Measure your dog from the tip of the nose to the base of the tail, and add about ten centimetres. Then measure from the floor to the top of the head with your dog sitting, and add another five to ten.
The test is simple: your dog should be able to stand without ducking, turn round without shuffling, and lie flat on their side with legs out. If any of those three is a squeeze, go up a size.
Buying for a puppy
Buy the crate your puppy will need as an adult, not the one that fits them now, and use a divider to shrink the usable space while they're small. A crate that's too big for a young puppy makes house training harder, because they'll use one end as a toilet and sleep in the other. The divider moves back as they grow, so one crate lasts.
Introducing it
Leave the door open and let your dog wander in and out for the first few days. Feed meals inside it. Throw treats in and walk away. Only start closing the door once going in is entirely normal.
Never use it as punishment. A dog shut in a crate as a telling-off learns the crate is a bad place, and undoing that takes far longer than doing it properly in the first place.
How long is too long
A crate is for sleeping and settling, not for storing a dog. Adult dogs shouldn't be shut in for long stretches during the day, and puppies need out far more often than that. If you're out at work all day, a crate isn't the answer and a dog walker or daycare is.
If your dog panics in a crate, barks constantly or tries to dig their way out, stop and get advice rather than pushing on. That's distress, not stubbornness, and it sometimes points to separation anxiety, which needs a different approach entirely.
Dogs in cars
The Highway Code requires dogs to be suitably restrained in a vehicle so they can't distract the driver or injure anyone if you stop suddenly. A crate, a dog guard or a proper harness clipped to a seat belt all count. An unrestrained dog on the back seat doesn't.
Worth knowing that an ordinary lead clipped to a collar is not a restraint and can do real harm in a sudden stop. If you're using a harness, use one made for the car.