As the particle physics implies, a negatively charged particle has a tendency to pull a positively charged particle in terms of the electromagnetic force. However, electrons and protons coexist in atoms without attracting each other and collapsing atoms into themselves. In other words, while protons coalesce into a nucleus, electrons travel around it as valence electrons in electron shells without making any effect to the nucleus.
Although it seems incongruous to create a mechanism with a particle couple that attracts each other progressively as a proton and electron couple does, it is the most solid structure we can imagine. The reason is as follows. Pauli exclusion principle, in quantum mechanics, states that any identical fermions cannot occupy the same quantum state even if there is more resort to fermions in that quantum state. To better comprehend this, we have to understand how bosons and fermions differ from each other. In particle physics, one way to classify sub-atomic particles is based on their spin. Bosons have integral spins while fermions have half-integral spins and this difference explains how protons and electrons can coexist in atoms. As I mentioned earlier, the Pauli exclusion principle does not allow any identical and indistinguishable fermions occupy the same quantum state, and so does avoid any attraction between any identical and indistinguishable fermions. It, also, explains how valence shells emerge and valence electrons bind to each other because of being pushed to the outer shells of electrons.
On the other hand, the sub-atomic particles that have integer spins behave differently as compared to ones that have half-integer spins. Bose-Einstein statistics describes the sub-atomic particles that have integer spins and according to the Bose-Einstein statistics, bosons can occupy the same quantum state, hence the accumulation of protons and neutrons in the nucleus. Since many of the properties of particles are quantized, the state of a particle is often described by a series of numbers called quantum numbers(1).In other words, the charge of a sub-atomic particle, in quantum mechanics, always described as a multiple of a certain value and so is called quantized like the energy of a light beam with respect to the frequency. As another approach to the Pauli exclusion principle, no two fermions can have all their quantum numbers alike so that fermions cannot occupy the same quantum state despite the fact that they have all properties alike except their spin, and only the sub-atomic particles that have integer spins and all quantum numbers alike can occupy the same quantum state. Because of this significant characteristic, fermions follow the Fermi-Dirac statistics instead of the Bose-Einstein statistics.
According to the aforementioned description of fermions, the Pauli exclusion principle and the Fermi-Dirac statistics make possible the ordering of electrons around the nucleus of an atom and the ordering of protons and neutrons within the nucleus itself(2).
(1) Feinberg, Gerald. "Elementary Particles." The New Book Of Popular Science Vol-3. Grolier Incorporated, 1988. 313. Print.
(2) Feinberg, Gerald. "Elementary Particles." The New Book Of Popular Science Vol-3. Grolier Incorporated, 1988. 314. Print.
Figure - 28.1 https://i2.wp.com/phenomenica.com/wp-content/uploads/2017/11/squarespace.com_.png?w=800&ssl=1
Figure - 28.2 https://www.iflscience.com/physics/quantum-mechanics-just-got-spookier/
Figure - 28.3 https://courses.lumenlearning.com/introchem/chapter/the-pauli-exclusion-principle/
Figure - 28.4 https://www.scienceabc.com/pure-sciences/how-to-find-the-number-of-valence-electrons-in-an-element.html
Figure - 28.5 http://users.aber.ac.uk/ruw/teach/215/qstat.png
Figure - 28.6 https://www.researchgate.net/figure/Plot-showing-the-comparison-of-current-obtained-from-Fermi-Dirac-statistics-symbol_fig4_323239548
Figure - 28.7 https://www.quantumdiaries.org/tag/spin/