The ps aux | grep x command gives "better" results than pgrep x essentially because you are missing an option with the latter.
Simply use the -f option for pgrep to search the full command line and not only the process name which is its default behavior, eg:
pgrep -f php5
Unlike the ps | grep construction with which you need to filter out the grep line or use pattern tricks, pgrep just won't pick itself by design.
Moreover, should your pattern appear in ps USER column, you'll get unwanted processes in the output, pgrep doesn't suffer from this flaw.
If you want full details instead of just the pids, you can use:
ps wup $(pgrep -f python)
which is simpler and more reliable than
ps aux | grep python | grep -v grep
or
ps aux | grep p[y]thon