Can a Letter of Recommendation be effective without much coursework
I think that a recommendation letter will be impactful even if the professor/lecturer writing it has taught the course or interacted with the student a decent time ago.
There are more important things pertaining to the strength or value of a recommendation letter (which is not praise from the person (since that must already be present anyway)) but things like:

The relevancy of the professor’s field to the field of your future work for which the recommendation letter is written for.
The amount of interaction with the person.
The current state of interaction with the person.
Any achievements that are recognized highly by this person and are mentioned in the letter (relevant to your area of study/work).

In general, the reason why it is not recommended to get letters from the faculty in your first or second year of undergraduate study is because they may be professors teaching general classes, which might not be relevant anymore or not specific enough to your current interests.
If however you believe that the work you did with a professor 2-3 years ago is still highly relevant to your application, then don’t hesitate to get a recommendation letter from them.