On one of my zoom lenses (Pentax DA 18-55mm WR), the inner barrel and focusing ring suddenly started to come a bit loose (not sure how, I handle it carefully). They can now move around a millimeter or two. I would imagine that precision products like lenses have very little tolerances before wobbly parts affect image quality, weather sealing etc. So far I have not noticed any effects. Would I be well advised to exchange the lens?
Depending on the build quality of the lens, the optics themselves are probably on very rigid guides. It's not necessarily all that uncommon for a focus ring to get a little loose as gears wear down. I'm not sure what you mean by the inner barrel coming loose, but if the lens can slide without turning the zoom ring, that's also a fairly common problem. (Some lenses even do it out of the box if you angle them down.)
As long as it doesn't start impacting optical performance it shouldn't be an issue, but it might not be a bad idea to call Pentax and get their input on it. They would know better what is typical for that particular lens model and what might be the first sign of problems to expect.
If the glass elements move at all (except for the zoom and focus movements obviously) it will impact image quality, the exact problem depends on the glass movement but common problems are softness (often unevenly across the frame) and focusing problems.
If the plastic parts of the barrel become wobbly without moving the glass it shouldn't effect image quality but can effect ease of use and whether sealing - or maybe not, it all depends on what came loss and the construction of the specific lens.
Also, every time something that shouldn't move moves there's danger it will damage other components inside the lens, the modern lens has a lot of tiny fragile cables just waiting to be dislodged by a piece of wobbely plastic.