What kind of symmetric-key algorithm to use with Diffie-Hellman?
What you are looking for is a key-derivation function.

As you have correctly observed one can make mistakes when using a shared secret and the KDF does exactly what you want.

A typical implementation would be a hash.

Note that short keys are not really an issue here. They should only occur with appropriately small probability and when padded with zeros would be acceptable keys.