Buffer is primarily a solution that can resist the variation in pH of a solution at a specific pH range. The buffer comprises the weak acid or weak base in a solution. For example- we cannot make a buffer with HCL because, this is a strong acid. It has to be something like HNo2 or Nitrous acid because its a weak acid.
In addition to this, we should have weak acid or weak space conjugates. So, we need to put the salt that contains the conjugates of that weak acid or weak base. A conjugate is a compound that is differ by the one proton. for example - NH3 and NH4+. So here is a difference of one proton. and, these are termed as the conjugate pairs.
For more understanding, I have attached one of the best book. Go through the 2nd chapter of this book.