In case if you lose your phone, you are not able to access your account without the code, and you must ask for 2FA deactivation if you wish to access your account in the meanwhile.

Concerning the lost device, usually, to migrate your 2FA app information from one device to another, you must be in possession of the older device as well.

In case you are not, please check the Google 2FA support link for more questions or the support for any other app you have been using to try retrieve the code for activation on a new device.