PNWDrew is probably right. Its most likely the gas valve coils. What happens is this, one of the coils gets a hairline crack in its winding. When its cold it functions and opens the gas valve, When the coil winding gets hot it opens and no more gas till it cools back down. Eventually it will just fail all together.
This is the parts diagram.
Parts for Samsung DV338AGW/XAA-0000 / : Heater Assy Parts - AppliancePartsPros.com
Its part of 3-4 assembly
Samsung DC62-00201A Valve - AppliancePartsPros.com
I can't see why these wouldn't work. Most appliance manufacturers make separate coils you can replace, why Samsung doesn't list them is beyond me.
Whirlpool 279834 Dryer Gas Valve Coil Kit - AppliancePartsPros.com