As you know, iPhones have a USB security feature that prevents the port from being used for data transfer when more than an hour has passed since the phone was unlocked. However, this security measure does not work when the phone is charged and actively used.
The publicly available USB port can be used to transfer malware to a computer, tablet or smartphone. This means that hackers can access sensitive data on the device, doing many harms, from stealing usernames and passwords to stealing money. The only way to stay safe is to use your own USB cable for charging in public areas.
The FBI also issues well-known warnings not to perform sensitive operations on public WiFi hotspots, not to open suspicious documents, not to use the same password for all accounts, and not to click on unwanted links in sms and e-mails.