Use this library to export the users and groups - AEM Exporter
How to diff users between AEM instances | AEM 6.x
How do we compare users and groups between AEM instances?
There are some ACS Commons tools that could help in exporting users from AEM in order to perform a diff:
You would have to do some post-processing on the json to make it so you can compare it though.