I have had the same on a Galaxy Note 9 ... And think I have figured out why ...
This is an Android OS Issue ... Not Hardware Related !!!
The Phone has been connected to an extrrnal device (game controller, Flash Drive, Android Auto, or similar) and part of that connection was to change the USB Connection Defaults to suit that device. Reconnect the device and see if you get different options.
1. "AndroidAuto" was what changed the settings for me ... after I re-connected to AndroidAuto, and changed the preferences about auto-start and auto-play-music etc, the error message/notification went away.
2. My Phone charged again when cable was connected and I tapped the Notification "Android System - Charging connected device via USB - Tap for other USB options" and chose "This Phone" ... You MUST connect Charging Cable first, to get option for "This Phone"
Hope that helps ...
Beauvaidos