If you can't see files on the improperly-ejected USB drive and it keeps disconnecting from your Mac, it's likely corrupted. When you remove the drive without ejecting it, you might have interrupted some ongoing file transfer and corrupted your data and drive.
I suggest you boot into Safe Mode to see if the files are accessible.
If it is, restart your Mac and see whether the drive works in regular mode. If it doesn't, back up your files in Safe Mode and reformat the USB drive.
If rebooting into Safe Mode makes no difference, you can try connecting the drive to another Mac if available.
If the above doesn't help, use iBoysoft Mac Data Recovery to retrieve the files and then reformat the drive.
This data recovery software can restore inaccessible files from your USB flash drive with a few clicks. In fact, it's capable of recovering deleted or lost data from all types of internal and external storage devices, including HDDs, SSDs, SD cards, etc.
It's compatible with Intel-based and Apple Silicon Macs running on macOS 13 Ventura ~ Mac OS X 10.11 El Capitan. Click the button below to download and install it on your Mac. After that, you can scan your USB drive and preview the lost files for free.