Dryer receptacle on sub-panel feeder
If it goes to a subpanel, it's a feeder.  

You cannot put a receptacle on a feeder.  

What needs to happen is the dryer receptacle needs to be replaced with a blank junction box cover, and then a new 10/3 cable run from a dryer receptacle in a new box, to either main or sub panel, where it'll land on a 30A breaker.  This means the 10/3 cable will be alongside the 8/3 feeder, either to the main panel or to the sub.  

You can use 8/3 for this dryer run if you really want to, but I don't see a reason to do that.  Dryers won't pull more than 30A (really: &lt;24A) because every dryer manufacturer expects a 30A circuit, and sizes for it. 

Once the entire 8/3 feeder is devoid of receptacles, it can be upgraded to a 40A breaker, because that's allowed on 8/3.  In practical terms, that will support the dryer and 1 receptacle circuit on each leg of power (so 2 if balanced). 

One more thing.  If the subpanel came first and the dryer plug was an afterthought, it's possible this was spliced inline, and that probably means the wires in that box are way too short. You need 6" of length past the clamp, or 3" beyond the surface of the box.  In that case, move the box so one end has enough length, and re-run the other end.  Better, leave the "enough length" side as the dryer branch circuit, scrap the other end, and run a whole new feeder in 6AWG, bypassing the box entirely. 6AWG gives you 60A at the subpanel.