To answer your question, non-custodial exchanges are relatively safe. But if you want a better method, get yourself a cold wallet so you can store your funds there. If you are not planning to buy huge amounts of cryptocurrency that you will need to withdraw as soon as you can, then you can make an account on any popular exchange and purchase there. Then, send the funds to your cold wallet. That way, only you will have access to your funds. Dont lose your cold wallet though, as no one else will be able to retrieve it not even you or the hackers.