Yes, this is acceptable as the Code de la Consommation (article 122-1) says “it is forbidden… to make the sale of a product conditional on having to buy a specific quantity”.
One condition is that you should not damage the other items left on the shelf.
For example, in the case of yoghurts grouped together, you can take one out but should not damage the others (eg. by ripping the lids).
You should also check that the item is not already on the shelves in a single format.
There are exceptions, where items are packed together for the convenience of the user, such as eggs in a box or slices of ham in a pack – so you cannot, for example, take out one egg.
Regarding use-by dates, it is usually safe to use items if you have not opened them and the date is a DDM (date de durabilité minimale), a date up to which the item is likely to be of optimal quality.
This does not apply to highly perishable goods.
The latter will have a date limite de consommation after which it is possible there will be health risks in eating it. In that case, you could take it back to the shop, with the receipt if you have it, and ask for an exchange or refund.