To keep this note here.
I found what helped me with xcodebuild. Just called the sample command before run xcodebuild.
Found solution here:
https://twitter.com/DonnyWals/status/1692508366109630888
If you've been struggling to get Xcode 14.3 to run apps on your iOS 17 devices try running the following command in terminal and then relaunch Xcode: defaults write com.apple.dt.Xcode DVTEnableCoreDevice enabled
Source: https://developer.apple.com/forums/thread/730947