Typically, a practical implementation of something like this would have phones reporting their discovery of a beacon to a server, which would from their ability to hear a given beacon then know their high-accuracy location. The server could then (subject to some set of rules) tell them about other devices in the area, and proxy data between them.
You'll need the server anyway, as the options for direct mobile-to-mobile data transfer are quite limited.
Also, an iOS device cannot advertise as a beacon in the background, but it can (to an extent) discover beacons while in the background, so having the phones be listeners rather than transmitters will make your app more usable.