Theory and question on using a photo interrupter as a switch
Basically yes.  An opto sensor like an IR encoder works exactly like you think,  but your wiring may change. Also, a dollar bill is fairly see through so it may not work.