Hello Peterfroge! First of all, welcome to the forums!
So, the first thing I am noticing is that there are a few things that are sub-optimal for your dragons setup. First of all, it appears you have a coil UV. Now, while I personally don't have the same vendetta against coil UV bulbs a lot of the posters here do - I personally have had good experiences with them - the issues that you're talking about could easily be the result of too little UV light exposure. With the size of your tank, especially, that little coil bulb probably isn't going to give your dragon enough for proper digestion and D3 synthesis which can lead to the issues you're describing, and eventually MBD and even death. Additionally, coil UVB bulbs have a higher rate of manufacturing defects that have caused eye issues - including blindness - in the past.
What you want to switch to is a tube-type bulb - there are a few options brand wise, but the fixture and the light will cost between $40-80 bucks together in my experience. Other posters will be able to tell you more about what to buy, and you can also read this for reference:
https://www.beardeddragon.org/articles/newbies-guide-lighting-help/
Depending on your financial situation, that might be a lot of money for you... It definitely needs to be changed ASAP, but it isn't an urgent ASAP. If you can afford it now, do it now, if you have to wait until next paycheck, it will probably be fine. A stop-gap measure, depending on your location, would be to take your dragon outside and expose him to natural UV for a few minutes or hours a day.
Another issue with your setup is the loose substrate. Again, loose substrate is not the devil, however it does put your dragon at a greater risk of impaction, which is very dangerous. When was the last time he defecated? If it was within the past week, you're probably OK, but you should still swap to a tile, mat, or paper substrate today.
Cheap options are newspaper or paper towel lining the bottom of the tank. I personally use fleece, or a product called repticarpet a lot of us on here love. Tile is another good option, though I personally don't have much experience with it.
Regarding loose substrates - like coil UVB, people on here tend to react with a strong negative as soon as they see it, but rarely offer a complete reason why. Obviously a bearded dragon would be on loose substrate in the wild, so why is it a problem here?
Well, first of all, comparing your breeder-bought beardie to a wild one is very similar to comparing a dog to a wolf. Essentially the same animal, they can interbreed even, but they have different needs. Captive beardies have gone generations under selections based more on looks and personality rather than hardiness. Second of all, that wild beardie is able to adjust it's habits as it feels it needs to to perfectly thermoregulate and seek out hundreds of food options to feed itself properly, while a captive beardie only has a few feet to roam around in and a handful of food options which you provide. Because of these two reasons, it is very easy for your dragon to get just a little sick for various reasons - not like sick-sick, but sick in the same way a college student might be even when healthy - cramped conditions, little ability to change their environment, and not quite-the-right food over months makes an impact. They might still be perfectly happy, and functionally healthy, but technically have some small deficiency that goes unnoticed.
If your husbandry is absolutely - and I mean absolutely - perfect, then you will likely never have an issue with impaction on loose substrates. However very few of us can say our husbandry IS perfect, we as reptile keepers are always improving our setups for the good of our animals. When a beardie is low-grade unwell, the biggest factor being if your dragon is slightly dehydrated, and digests a bit of it's substrate, that's when you have a high risk of impaction. That's also why loose substrate is more permissible with adults than baby dragons, as babies have smaller digestive tracts (takes less substrate to clog them) and are more delicate in general (dehydrate or suffer other issues much easier). Because no one's husbandry is 100% perfect, that is why you should use a non-loose substrate, to prevent any risk.
Other things I noticed about your setup are that I don't really believe the heat light would produce enough heat for the enclosure and your should double-check your temps and that you don't have many hides/enrichment in your tank.
I really hope this helps. Please feel free to message me with any questions, and I'm sure other people will be posting soon to give their 2-cents!
Good luck,
-Ellen