In the American structuralist tradition, a phoneme is defined according to its allophones and environments.
In the generative tradition, a phoneme is defined as a set of distinctive features.
Examples (English): Minimal pair
Here are examples of the phonemes /r/ and /l/ occurring in a minimal pair: