In short
QR code and DataMatrix are two-dimensional (2D) barcode types that carry many characters in a small area and remain readable even when damaged.
DataMatrix is used in industrial applications such as direct part marking (DPM) and pharmaceutical serialisation; QR codes are mostly used on labels and documents read by mobile devices.
Both formats can carry product code, lot, expiry date and serial number using GS1 data structures.