A filter is a program that reads standard input, transforms it, and writes standard output, so that it can stand anywhere in a pipeline: sort sorts lines, uniq -c collapses runs of equal adjacent lines and counts them, wc -l counts lines, head and tail keep the first or last lines, cut keeps fields, tr translates characters, paste joins lines.
uniq -c counts only adjacent equal lines, hence the sort before it.