Potassium’s electrical and chemical driving processes are opposite to one another. The two forces exert a driving force that pushes sodium out of cells during difference in its concentration. While the electrical force causes the sodium to be pulled into the cells. The actual means of understanding the process is complex.
Basically there is a chemical gradient that depends on the relative concentrations of two ions on each side of the membrane. While the electrical force exerts an influence depends on the charges on the two ions as well as the concentration difference and the charges which ultimately produces a balanced effect.