If your Mac is acting up and you suspect a hardware malfunction, try running Apple Diagnostics to see if it identifies any issues. Instructions here: