Do barcodes allows to uniquely identify production items?
A Barcode is nothing but a ln alphanumeric sequence in machine readable format. There are various formats of 1D Barcode, with specific encodings or purposes like UPC or ISBN, as well as 2D codes like QR or 3D codes. 

Regardless of the type, they can be fairly arbitrary in the data they hold.  Yes, you can use one for arbitrary production batch tracking by printing the same Barcode on each item in a batch. 

But if you're trying to use an already printed Barcode for anything else other than what it was printed for, it won't work. In your specific case, the only Barcode on a aspirin box will be the UPC for that manufacturer and product code.