There is a broad consensus that hardware wallets are the most secure. This is because they are a form of cold storage, meaning that the private keys are kept offline and never connected directly to the internet. Transactions are sent to the wallet, which signs them using the private keys stored on the device and then sends the authorised transaction back to your computer and onto the blockchain. But the private key itself never gets moved onto your internet-connected device.
This is different to software wallets, which store your private keys on your computer or smartphone and leave them vulnerable any time your device is connected to the internet.