That doesn't return the last inserted ID. It returns the ID property of that user object. No database query is performed on that line.
If the user model was just created, that may be the last ID in the table. Or maybe another user just registered and it's no longer the last one. If you want the actual last ID, you have to perform a database query that fetches max(id) from the table, but even that may no longer be the last value by the time you're processing it.
In practice, you basically never need to fetch the max ID of an auto-incrementing column. You let the database handle it. What are you trying to use it for?