Since the iPhone X does not have a dedicated headphones port and would require a Lightning to headphone adapter, have you tried another adapter?
If so, then here are, at least, three things you can try since you already attempted to clean the iPhone's Lightning port:
- Perform a "soft" reset on your iPhone. For an iPhone X, Press and hold both the Side (Power) and either the Volume Up or Down buttons.
- Perform a "Reset All Settings" on your iPhone. Settings > General > Reset > Reset All Settings
- Reset your iPhone to its factory default settings. Settings > General > Reset > Erase All Content and Settings (Note: This type of reset will erase all of your phone's data and media and resets all of the iOS default settings. You will need to restore it from a previous backup.)
If none of the above work, I suggest that you make a Genius Bar appointment at your local Apple Store or Apple Authorized Service Provider to have them take a look and provide you with your options.