I read that capacitors(especially decoupling ones) have to be placed as close as possible to their position. Does the same apply for resistor also? Can resistor be placed not close enough, lets say far, from a transistor for example or from an other circuit that resistor is part of it?

Does the distance of components only apply to capacitors or not only?

I am talking about components and not lets say feed line of antenna obviously.