So lets assume these things are in series. Yes, it matters, and as a terrible analogy ignoring all physics for a second, you can think of it as things must flow through one thing to get to the other.
Now lets say this capacitor has a parallel connection to ground. Look up bypass capacitors for an example. In this case, technically is does not matter as long as you have the capacitor connected to that trace and ground. It could be a mile away.
Back to the physics though, yes it matters. The passives serve a purpose, and that purpose is to add or negate resistance, capacitance, and inductance. Generally these things will limit current or voltage into an IC pin so as not to overload its max specs. A bypass capacitor for instance should be placed close to the IC in order to kill the resonant frequencies in that area. The further away it is, the longer the current's return path. Then you start getting into traces impedance and resistance, blah blah, blah.
So it won't matter to much unless it is power or an analog measurement signal. If they are, try to place the components close to the pins, not far of on the side, and look up "bypass caps pcb". You will find that this is a very deep field, but protoboards attempt to limit how much you have to know so that it is accessible for beginners. The key there is to look at the max specs for the protoboards pieces and give yourself a good error margin.
Hopefully this helps and please look into the book "High Speed Digital Design: A Handbook of Black Magic". Amazing book.