If() and require() have separate functions and cannot be used interchangeably.
if(): when the first condition becomes false the next condition i.e else block gets executed.
require(): it has a diffrent function. It is actually an error handling statement, and when the require condition is false, the execution stops and the transaction gets rolled back.