Crates and pet carriers are fine as long as they’re well ventilated and firmly attached to the vehicle. Otherwise, the crate will become a dangerous projectile in a crash. Purchase a restraint specifically designed for this purpose rather than making your own. Built-in vehicle barriers are available from the factory on many cars. These gadgets form a cage-like structure in the back of the vehicle.
Which ever restraint you choose, practice installing it in the vehicle and on your dog before you rev the engine. Never restrain Fido in the front seat. If the airbag deploys, the impact can kill him.