Yes both. But often the preamp is sited because it is further up the chain and anything lost or tipped in a particular direction is simply lost to the amp.
The preamp is about nuances and small signals… so you want a really good one. So, in this regards, most of us will choose the preamp first and often put more money into it. I think if you get the right preamp, it can easily out last many sources and amps. That has been my experience over the last 50 years anyway.