This is what i have:
$stmt = $handler->prepare('SELECT id FROM users');
$stmt->execute();
$id = $handler->lastInsertId();
echo $id;
So, i want result to be for example "There is $id registered users".
You never need to select the "last id" from a table. Every time you think you you need it, you need something else. For example, whatever "Last id" has nothing to do with the number of users registered. Instead, you have to count users:
$count = $handler->query('SELECT count(id) FROM users')->fetchColumn();
echo "There is $count registered users";