WiFi / Range / Distance Sensor
In terms of sensors, the most appropriate would probably be some kind of time-of-flight (ToF) sensor, also called a distance or proximity sensor. Some even call them LIDARs.
It sends a signal and measures how long it takes to come back after having bounced on an obstacle, yielding a distance.
There are many types, using lasers, light, ultrasounds... They have varying characteristics in terms of range, precision, the angle they cover, their power usage, etc.
Just connect one of those sensors to a wireless MCU (probably an ubiquitous ESP32-based board), and monitor the distance. If it drops below the given threshold and remains there long enough, send a message over WiFi. How it will notify you (email, text, app notification, siren, visual alarm...) is up to you.
ToF sensors are active devices (they have to send something to measure the distance), so they draw more power than a PIR sensor which is passive. This means having the device run on battery will be more difficult, so you may have to be creative and only measure every minute for instance. It is possible that combining a PIR sensor (to detect movement using very little power, wake up and start measuring using the ToF sensor) could help. If you do need to run on battery, double check the board’s deep sleep current, many are not optimised at all for that.