Look at the end that plugs into your phone. The metal connector and its housing should form one piece. If the tip is bent, pulling free, or lying loose on the table, set the cable aside. Trying it on a second phone risks damaging another port.

The metal piece on the table belongs inside the plug. Retire a cable that has come apart.
Photo: Broken USB Type-C Cable.jpg · Eavesdropper6735 · CC BY 4.0. Web-size copy. Creator removed a logo before release.
If the broken cable is already disconnected, keep the loose pieces together and away from children. Leave it out of the household charging drawer. Avoid taping the plug together or pushing a broken tip back into a port to see whether it still works.
If a piece is stuck in your device, leave it in place and ask a repair technician to inspect the port. Try “The tip separated from this cable. Can you check the phone before I plug in a replacement?” Bring the cable and loose piece so they can see what broke.
Reader reference: Apple · Important safety information for iPhone