It uses the accelerometer that has already been built in to iPhones going way way back (actually ALL iPhones have at least a 3-axis accelerometer), so that's why there is so much support for older devices.
It was added in iOS 14. Not hardware specific. It works on my iPhone 11 Pro Max. It's an accessibility feature that has to be specifically turned on though.