As UK nationals do not normally have identity cards, a photographic driving licence can serve many of the purposes of an identity card in non-driving contexts, such as proof of identity (e.g. when opening a bank account) or of age (e.g. when buying age-restricted goods such as alcohol).

is it law to have a photographic driving licence?
no