It would be much simpler if your alarm can be at the receiver and the "certain distance" doesn't have to be very accurate or precise: you could use small commercial BLE beacons (e.g. iBeacon, Eddystone), receive the beacon signals with a bluetooth module+Arduino or RPi to get RSSI and set off an alarm when the strength drops below a "certain value."
There's also this RFID device, but it only reaches the low end of your range (5m). And it is subject to the same limitations: alarm at the receiver, not very accurate.