Depends on your situation... one of mine is currently crated overnight.
He’s an adult, but only been living in a house since he got here 2 weeks ago, so he’s not fully housetrained, hasn’t worked out what’s edible and what’s not and we have an existing dog with some behavioural issues that we don’t want him to be unsupervised with and a cat.
So a crate next to my bed is the best solution and when he wakes up he can be taken outside for the toilet.
2 dogs ago had medical and behavioural issues that meant periods of crate rest after operations and that he wasn’t safe to have round people he didn’t know, so was crated as part of the introduction process to new people... he also insisted he be crated overnight, he could open the door, it wasn’t locked but he wouldn’t settle unless I pushed it over, lol.
The existing dog we’ve had for 2 years, could honestly do with being crate trained, he’s very anxious and reactive, but, he panics with the door closed so he still isn’t. So it’s just based on what each dog needs and can cope with.
More than one pet and complicated dogs mean crates are pretty invaluable tbh.