Is there any function I can call to get a distinct Serial number of the hardware?
I wish to register which Esp32 cam belongs to whom.
There is no serial number in an ESP32.
You can use the WiFi MAC address as a relatively unique number (You can change the MAC address to whatever you want). There is also the ESP.getEfuseMac(); function.
See https://forum.arduino.cc/index.php?topic=613549.0 and https://randomnerdtutorials.com/get-change-esp32-esp8266-mac-address-arduino/