You should list out all the components in your computer, and how long has it been running well before these problems surfaced. If it's a recent build, maybe the motherboard BIOS isn't compatible with the AMD Ryzen 5 3400G? Check the motherboard maker's website for a more recent BIOS version to start with. Also look at your memory settings to see if you are running them at too high a frequency. Everything should be set to default values (no overclocking), meaning stock voltages and frequency settings. Once a system is stable, then you can experiment with more performance.
As Albert Einstein said, "I could have done so much more with a Big Al's Computer!".