Accessing an Apple ID that was associated with a lost device will not prevent you from using that Apple ID on other devices or through a web browser, provided you still have access to the account. If you claim you can no longer access the Apple ID, it typically indicates one of the following scenarios:
- Account Credentials Were Shared or Compromised: If someone else has access to your Apple ID credentials (email address and password), they could potentially change the password, recovery options, or security settings, locking you out of your account. This often happens if the credentials are shared or exposed through phishing or a data breach.
- Security Measures Triggered by a Lost Device: Apple has robust security features, such as Activation Lock, which prevents unauthorized access to lost or stolen devices. However, losing a device does not inherently lock you out of the Apple ID itself, as the account remains tied to you. You can log in to iCloud or other Apple services with your credentials.
- Forgotten Password or Inaccessible Recovery Options: If you forget the Apple ID password and can’t access the associated recovery email or phone number, you may find yourself unable to regain access. This situation isn’t directly related to the lost device but rather to your ability to manage account recovery.
If you do not remember the Apple ID Password then follow the steps given in this Apple Article -> If you forgot your Apple ID password - Apple Support
If you do not remember the Apple ID then follow the steps given in this Apple Article -> If you forgot your Apple ID - Apple Support

If you are the owner or the owner has shared all information with you then to open Activation Lock:- If it is Activation locked, read here --> Turn off Activation Lock - Apple Support Activation Lock for iPhone, iPad, and iPod touch - Apple Support
Learn how to remove a device from a previous owner's account.
If you are not the owner and do not have the Apple ID and Password then there is no way that you can get into this iPhone unless the original owner shares the Apple ID and password with you. If you are lucky you can get into this iPhone if they (owner) accidentally remove the device from their Apple ID.
