ChatGPT is indeed correct that this is a structural limitation.
There are a couple of things, which , in combination, makes two iOS devices detecting and connecting to each other when both apps are in the background not feasible, or even possible.
Peer-to-peer discovery using Bluetooth means you will have one app acting as the central and continuously scanning, and the other app acting as the peripheral and continuously advertising.
When a scanning app is in the background, two things change specifically. The didDiscoverPeripheral() method will only be called once when the other phone is first encountered, as opposed to multiple times when the app is in the foreground. Also, your app is required to have specified a service UUID in the scan command. If the services parameter is nil, the scan will not work when the app goes to the background.
Understanding these are the hard limitations, there is also a set of changes in the system behavior that will make two iOS devices to be able to detect each other not practically feasible.
In general, advertising is done on a best effort basis. As Bluetooth is a shared resource, when other apps and system resources need to use Bluetooth, advertising for apps in the background will slow down, and may even stop for periods of time. The rate of advertising is directly related to the probability and time required to be discovered by a scanning device.
On the scanning side, the scan rate also drops once the app is in the background. Scanning rate is also directly related to a timely discovery. Also, both these rates will further slow down when the phone screen goes off, and even further down after a while when the phone goes to sleep mode.
Unfortunately, all these restrictions and slowdowns end up making the discovery process very slow, to the point of becoming unusable. It could potentially take minutes, if not longer.
So, if your use case is that the two devices detect each other promptly when they get close to each other, and both devices are locked or running other apps - meaning your apps are not in the foreground, things will probably not going to work as you wish it did.
As these limitations in behavior is systemwide, and by design for power management purposes, there are unfortunately no workarounds we can offer at this time outside of trying to keep at least one side in the foreground.