Are you asking because of a specific (e.g., battery, touchscreen) or are you evaluating a used iPhone ? Let me know, and I can suggest the best diagnostic tools for that situation. My Device Info! - App Store - Apple
Helps check sensors and parts, according to App Store descriptions.
Dial *#06# to immediately show your device’s unique IMEI number, as shown in this PCMag article.
You can initiate a hardware test by turning off your phone, holding both volume buttons, and plugging it into a charger, according to this YouTube video .