16bit UUIDs are standardised by BluetoothSIG. UUIDs for custom profiles must be 128bit. You can generate these using a UUID generator - the idea is that using a generator and having 128 bits is enough to almost guarantee they will be unique.
The handles are generated at run time by the GATT server when each service is registered with GATT