An alternate part can keep a product in production when the original is unavailable.
Compare the datasheets line by line
Check electrical ratings, package, pinout, thermal limits and operating temperature range.
Check the qualification needs
Regulated industries may need re-qualification or customer approval before a change.
Validate in the actual circuit
Test the alternate in the actual circuit before approving it for production.