Using Transaction with multiple outputs
Each transaction draws on a set of [1..n] Unspent Transaction Outputs to spend. These we call the inputs of a transaction.
The transaction then assigns the total value of the inputs to [0..n] new Unspent Transaction Outputs. Each UTXO is associated with the creating transaction and uniquely numbered among that set. The most common script that makes up a UTXO is "pay-to-pubkeyhash", where an UTXO can only be spent in combination with a valid signature by it's recipient.

The value of the outputs must be smaller or equal to the value of the inputs. The difference of those two totals can be claimed by the miner as transaction fee.

To come back to your example:

Transaction A1:
Alice -> 5BTC -> Bob (Transaction A1, output 0)
Alice -> 5BTC -> David (Transaction A1, output 1)

(Alice needs to put in at least 10BTC for that transaction.)

Bob wants to spend his money:
Bob -> spend(Transaction A1, output 0, signature) -> new recipient.

Since each UTXO is uniquely identifiable, they cannot both try to access the same UTXO.