Are air bubbles/pockets/loose casing in raw sausages okay food safety-wise? I don't know if it's just because they didn't fill them as full or if they formed from gases/bacteria. They are five days before the best before date Merguez sausages. Thanks!
It is most likely just a void. It is hard to pack a casing 100%. There will be voids.
Could it be (toxic) bacterial gas? Maybe but not likely.
To avoid it, you'd need to pack them in a way that makes them more like hot dogs than sausages. Hot dogs are a smooth emulsion of (usually) reclaimed meat, fat and spices. Sausages are mince that's been somewhat loosely packed and cooked (usually smoked) in a casing along with herbs, fat and spices.
With synthetic casings, you can pump a bit more pressure resulting in a denser sausage with less air, but there's still going to be some. However, the hallmark of a great quality sausage is a natural casing, with little nooks of air, fat, spices, etc.
What you have sounds like quality sausage in a natural casing, and you should positively consume it when it's fresh (ideally within days of buying it!). But there's nothing wrong with leaving them out in the back of the fridge to age a little bit (really helps bring out the flavor of fennel / anise) prior to cooking them up, and they will be a little loose and crumbly.
If you pick up on even a slight acrid taste or smell, don't use them. Otherwise, you're fine.
The casing on a fresh sausage needs to be left somewhat loose because the casing will contract when it's cooked. If it were stuffed as tightly as possible, it would be almost certain to split open in the frying pan. Even for a sausage that will be poached first (boudin blanc, e.g.), which causes the casing to shrink much more gently, you must account for that shrinking.
Air bubbles are simply a natural consequence, as Tim Post says, of the size of the grind. You notice that tennis balls in their can also have "air bubbles" around them. If there are a lot of bubbles, it's a sign of perhaps not-quite-painstaking manufacture: usually the bubbles are pierced after the links are formed. This is again to prevent splitting: the air will expand when it's heated and that can rupture the casing.
The pockets are not a danger sign by any means, though. The only worrisome hypothetical I can think of would be that they appear to inflate on their own while the sausage is in cold storage: that means something alive is producing gas. (My guess would be that'd just be harmless yeast, but) When in doubt, throw it out.