I recommend 2 solutions1. Get rid of M series and buy another one2. Take it to a local service centre where they have chip level servicing . They will do a cpu reballing which should solve your issue.
This is a common issue with M series. Exactly after warranty period the issue will arise and if you take it to authorised service centre they will tell you to replace motherboard.
Don't worry samsung just needs you to buy another phone. They provide updates for making devices hang so that they get more customers in service centres.