The trailer lights are on their own circuits, here's a listing of all the fuses:
F53 ATR 20 amp Left Trailer lights
F81 ATR 20 amp Right Trailer lights
F29 FMM 20 amp Trailer Park lights
F28 FMM 20 amp Trailer Back up lights
F30 FMM 30 amp Direct from battery
F11 J Case 30 amp Brake Lever
F87 ATR 10 amp ITBM module
The tail lights can work even though the trailer lights won't.
If it's not a fuse, the most common area for problems with the wiring harness is where the wiring harness is routed near the back of the front driver's side tire, you need to pull the wheel well liner down to get at it.
This has been an issue with Dodge/Ram trucks for a long time.
My FIL had a 2003 that showed no issues with lights or turn signals when not hooked up to a trailer. But once it was hooked up to a trailer, in his case the left hand turn signal of the trailer did NOT work. He took it to a dealer who, instead of diagnosing the problem, just spliced wires into the tail light..which gave him a left turn signal but no left brake light (not really any better). They took it back, the tech undid what he'd done, then proceeded to say he couldn't figure it out and would need to call in a Chrysler rep (basically the tech was an idiot).
I did some troubleshooting on it and found where someone had bypassed the wiring harness where it had chaffed through to get the lights working on the truck instead of fixing the wiring harness, but because of the splicing that was done I didn't want to try to fix it in case I made it worse.
So he took it to another dealer...who had seen this exact problem before, and found the easiest solution was to pull the BCM out and replace it with a Ford part number. Everything plugged right in and it mounted in the same location...but it put the brake light and the turn signal on the same bulb instead of being separate bulbs as they had been, which in turn fixed the trailer plug (since the trailer brake/left turn signal is the same wire).
I won't say it was the right fix, nor would I suggest it on a 2017 because I don't know what all has changed between then and now. BUT it's been a problem for years, one that you would think they'd have found a solution to (clearance the fender, better insulation/padding on the harness, something).