畀 and 被's modern pronunciations are quite similar.
Although 畀 can mean “give” like the Mandarin 给 it also can work like 被:
佢畀人睇見
他被人家看見
Do Cantonese 畀 and Mandarin 被 have any historical connection?
畀 and 被 are not related. In Old Chinese (F. K. Li's system) 畀 was pjidh, and 被 was bjiarx/h, phonetically quite different.
被 (the qusheng reading) was, and still is, a coverlet, etymologically related to the verb 'to cover' (the shangsheng reading). How 'cover' became a marker of passivity in a sentence is a long story; when something is laid on you, it's never you that does the laying, and the fact that it's an action external to you gives it a very passive feeling.
畀 originally meant 'give' in the sense of to 'bestow'; it came to be a passive marker is a very different fashion from 被; in fact, in most southern dialects, passive is marked by co-verb like structures with the meaning of 'give'; this is a regional feature, though the actual word differs from dialect to dialect; in the Minnan dialect, for example, it is 'ho', and its usage is very similar to 畀 in Yue dialects.
bei2
should be written 俾 when used as a passive marker and 畀 when used to mean 'to give', it's not clear that they are actually distinct words, because there is a continuum of meaning between the two. Take the following examples: 我畀啲嘢你做 "I give you things to do" > 我搵啲嘢畀你做 "I find things for you (i.e., to give to you) to do" > 啲嘢畀你做 "Things are given to you to do" or "Things are to be done by you" > 啲嘢畀你做咗 "Things were done by you"