My galaxy S21 5G still works fine copying files using a USB cable. You might try a different cable.
BTW, the way it works changed a little. It used to be I had to have the phone screen unlocked to copy files to the PC. If I didn't, I saw the phone under Windows File Manager but couldn't access the files.
Now when I connect the S21 to the PC using a USB cable I get the following popup on the phone.
After I select Allow I can still copy files to the PC even if the the screen is locked.
Note I don't usually use a USB cable to copy files anymore. Now I normally use the Phone Link app on the PC to access my phone pictures and screenshots with a wireless connection.