You can use H4895 for many rifle loads from .223 through .308, and more.

For pistol, something like Accurate #5 will be good for 9mm, .38, and mid range .357 magnum loads.

Special powders will cover the other 10 to 20% of needs, but you can get by nicely with just two.

For practical purposes, small rifle primers can be used in small pistol applications. Same size. I haven’t tried the reverse. Depending on the manufacturer, small rifle primers have a thicker cup than small pistol due to higher pressure requirements.