Por and para have different meanings in general, not only when they are used with quién. We have lots of different lessons both for por and para. If you click here you can see all of them.
Por quién can mean for example on behalf of whom, or because of whom:
¿Por quién arriesgarías tu vida?
For whom/because of whom would you risk your life?
¿Por quién hiciste ese trabajo?
For whom/on behalf of whom did you do that job?
On this last example, this would be said for example if a colleague can't come to work and you do the job he/she was meant to do.
Para quién can mean "who for" in the sense of who receives something or to whom you dedicate something:
¿Para quién has comprado esas flores?
Who did you buy those flowers for? (who is going to receive them?)
¿Para quién has escrito ese poema?
Who have you written that poem for? (who did you dedicate it to?)
The meaning of por/para is often given by the actual meaning of the verb we are using.
I hope this helps.