*How do the words 'by' and 'for' differentiate?
For is usually used with a direct object... For example: I am going 'for' five hours.
In this sentence, for is used to indicate how long one is doing something.
By is very different! By is most commonly used as a synonym for 'near': I live 'by' the river.
The usage of 'by' in this sentence says where I live in relation to the river... I live 'by' the river.
All in all, by is a preposition, which is a word that comes before a noun/pronoun that describes the relation of the subject to something else.
For is also more commonly used as a preposition, but can also be used as a conjunction (FANBOYS).