The phrase of "play a role" = "serve a function in"?

The phrase of "play a role " means “acts the part of” or “serve a function in”?

and could you show the meaning of each phrase?

In the movie “Evelyn”, Aidan Quinn acts the part of Irish-American lawyer Nick.

Water serves a function in digestion.

The meaning of each phrase is, as you suggested, “play a role”.