When you use “declare record” in a SharePoint Online library it makes the library un-deletable.
Even if you undeclare all records and remove all the files the “remove library” setting will be unavailable from the document library settings page in the UI.
Luckily this is easily remidied with some PnP PowerShell
Connect-PnPOnline https://.sharepoint.com -Credentials
$list = Get-PnPList -Identity ""
$list.AllowDeletion = $true
$list.Update()
Remove-PnPList $list -Force