Looks like the code sample isn’t completely up to date with the latest release. Just to correct if you are continuing with your own implementation:
For the first compiler issue, the method on IUserService you need to call now is GetAsync instead of GetByKey . The second looks like you need to import the Umbraco.Extensions namespace to make it available.