I also faced same issue in m31 but it resolved automatically.i don't know whether update helped me or not but now my m31 working smoothly.Advice:1.charge phone while enabling safe mode.2.dont let battery drop to below 28_30
Enable safe mode1.long press power key2.hold power off button 3.tape on safe modeThis will troubleshoot your phone.If this works then you get to know that 3rd party app is causing this.