How does the nature of nuclear force change between attractive or repulsive based on distance? I know that the nuclear force is responsible for binding the protons and neutrons together in the nucleus. The force is powerfully attractive at small separations and rapidly decreases as the distance between the particles concerned increases and becomes repulsive after that.But, why does that happen? 
I'm not able to find a way to explain it in anyway.How can a force be attractive and repulsive based on the difference between the concerned particles? This might have to do with how the forces actually work which I'm not familiar with. Please explain to me how this happens. Since I'm a high school student I will be unable to understand the high level math involved(if any in the answer given) so, I would like a conceptual understanding about the situation.   
 A: The question assumes that the nuclear force does have an attraction at long distances and a repulsive core at short distances. The reality is more complicated than that, and there is in fact no unambiguous way to decide whether this assumption is really correct.
The strong force between two quarks is often modeled with a potential $V\propto r^n$, where $n\ge 1$, so that the interaction doesn't get weaker with distance. This feature of these models reproduces the fact that single quarks are never observed free.
A nucleon is a composite object made out of three quarks. The nucleon is color-neutral, so to first order, we expect that a nucleon should not interact with another nucleon at all. This is in fact approximately what we do see, since at large distances the nucleon-nucleon interaction falls off exponentially. But the cancellation is not exact, and at small distances we do get an interaction. This is called a residual interaction, and it's exactly analogous to the residual interaction between two electrically neutral atoms, which is the van der Waals force, often modeled by a Lennard-Jones potential.
We do not have any usable way of inferring the correct residual interaction between nucleons from a postulated quark-quark interaction. So instead we make models. Some of these models have a repulsive core, and others don't. In particular, it is not necessary to have a repulsive core in order to explain the sizes of nuclei or the fact that they don't collapse; their sizes are fundamentally set by the Heisenberg uncertainty principle. For example, quite good global descriptions of the sizes and binding energies of nuclei can be achieved with interactions such as the Skyrme interaction, which do not have any such hard core.[Chamel 2010, Stone 2006] There are also successful models that do have a hard core.
If you want to use a model with a hard core, then you might like to have a physical interpretation for it, and a natural interpretation is that it's an exchange force, which relates to the statistics of the fermions. For comparison, this is the usual physical interpretation given for the repulsive term in the Lennard-Jones potential.
Chamel and Pearson, 2010, "The Skyrme-Hartree-Fock-Bogoliubov method: its application to finite nuclei and neutron-star crusts," http://arxiv.org/abs/1001.5377
Stone and Reinhard, 2006, "The Skyrme Interaction in finite nuclei and nuclear matter," http://arxiv.org/abs/nucl-th/0607002
A: Contrary to your existing comments and answers, the exclusion principle does not prevent two particles from occupying the same region of space. For example, consider the electrons in the $s$ orbitals of an atom. These spherically symmetric distributions have a nonzero overlap with the nucleus. For an atom heavier than radium, all seven of the $s$ orbitals are filled, each with two opposite-spin electrons. All fourteen of these electrons spend part of their time dwelling in the nucleus, and in fact have pretty large overlap in the regions outside the nucleus as well. Only if you consider the entire electron wavefunctions do you get the magic cancellation in the overlap. The exclusion principle totally allows particles to overlap in space, as long as they do so in orthogonal states.
What's happening in the nucleon-nucleon potential is actually relatively straightforward. The nucleon-nucleon interaction is governed by Yukawa potentials, $$
V \propto \frac 1r e^{-r/r_0},
$$
where the extinction distance $r_0 = (\hbar c)/(mc^2)$ depends on the mass of the boson carrying the force. The photon, as you probably remember, has zero mass, so the electrostatic potential is simply proportional to $\frac 1r$. The lightest of the strongly-interacting mesons is the pion with mass $m_\pi c^2 \approx 140\,\mathrm{MeV} \approx \hbar c/(1.4\,\mathrm{fm})$. The next important mesons to turn on are the $\rho$ and $\omega$, both with masses around $mc^2 \approx 800\,\mathrm{MeV} \approx \hbar c/(0.25\,\mathrm{fm})$.
There is a theorem (of which I have found mentions and technical explanations but not a citation) that in a boson-mediated force, there's a correlation between the spin of the force carrier and the sign of the force between like charges. If the force carrier's spin is even, like charges are attracted to each other. This is the case for gravity (masses are attracted to other masses), mediated by a hypothetical spin-2$\hbar$ graviton, and for the long-range part of the nuclear force, mediated by the spinless pion. If the force carrier's spin is odd, as in the case of the spin-$\hbar$ photon, you get like charges that repel each other and opposite charges that attract. The pion is a scalar particle (actually a pseudoscalar, though that's not important here), and so the pionic part of the nucleon-nucleon interaction is attractive. However the $\rho$ and $\omega$ are both unit-spin particles.
The nuclear potential is attractive at modest distances because the pion interaction gives an attractive potential. It turns repulsive because heavier mesons tend to have unit spin and carry a repulsive force betwen nucleons.
A: As this question came up again, I thought I would add a more simplified version as introduction.
Nuclear physics  studies took off when one realized that the nuclei were composed of protons and neutrons. This was organized into the table of elements, periodic table, which counted the number of protons , i.e. positive charges as Z, and total mass as A in atomic mass units. A, almost always larger than Z, gave the count of neutrons, as the masses of protons and neutrons are very close. It was known that it was the number of protons that interacted chemically and diferentated the elements so they were known as: hydrogen ...iron...uranium ... Chemistry depends on electromagnetic interactions.

In addition it was found that for each Z there existed similar in chemistry behavior elements, called isotopes, which had a different A, leading to a different number of neutrons for the same type of element, iron, gold, xxx.
It was known that like charges repel each other . Nuclei with more than one proton will have a repulsion between them. In order to explain the stability of nuclei another force was postulated, a nuclear force that was attractive and worked between protons and neutrons without discriminating between them and treated as nucleons. A balance between the repulsive forces of many protons and the attractive process of many nucleons was postulated to explain the stability of matter. So it is not one force, but a balance between attractive and repulsive forces, and further study showed that quantum numbers also have an important role. The nuclear force is always attractive, the electromagnetic always repulsive in the nucleus. The distance comes in because the closer charged nucleons approach, the largest the repulsion, the strongest the attraction, the balance depends on the strengths and the distance.
Here is the further study simplified:
Before learning about quarks and the fact that there exists three quarks per proton or neutron nuclear forces were modeled descriptively by potentials that fulfilled the observations and gave appropriate energy levels consistent with observations, like the shell model: 
1) that the nuclear force was attractive  as long as the electromagnetic repulsion from the same charges of protons was low enough, and this balance between the two forces created the elements table 
2) at that time protons were considered elementary particles  and neutrons were modeled accordingly following an SU(2) symmetry ( isotopic spin)
As fermions, protons and neutrons, they could not occupy the same quantum numbers in the solutions for the potential and that resulted as an effective repulsion, due to the pauli exclusion principle as commented above, not the strong force.
The models quite succesfully explain the periodic table of elements and the radiative and decay behavior of nuclei.
We now know that it is the quarks that are elementary and that the proton and neutron are composed of three quarks each according to the SU(3) strong symmetry, and that the force binding the quarks into the nucleons is very strong and it depends on what is called a "color charge" and a mediating boson, the gluon. Nucleons are color neutral and are attracted to each other with the nuclear force which is a spill over, residual  force from the strong colored forces within the proton and neutron.
