If your PATH actually contains ~/.local/bin with the literal tilde character: that won't work. The tilde needs to be expanded to your home directory.
For example, any of these lines are correct in zsh, bash or any other sh-like shell:
PATH=~/.local/bin:$PATH
PATH=$PATH:~/.local/bin
PATH=~/.local/bin:"$PATH"
PATH="$PATH":~/.local/bin
export PATH="$HOME/.local/bin:$PATH"
export PATH="$PATH:$HOME/.local/bin"
They work because ~ is expanded to the home directory when it's at the beginning of a word, immediately after the equal sign in an assignment, or immediately after a : in the right-hand side of an assignment (the purpose of this last rule is precisely for the convenience of setting PATH).
But a line like PATH="~/.local/bin:$PATH" won't work, because ~ is not expanded in double quotes, so the value of PATH ends up containing the literal character ~. This PATH references a directory called ~ in the current directory, not your home directory.
Bash¹ has a feature in which ~ is interpreted as the home directory at the start of path entries. So PATH="~/.local/bin:$PATH" does partially work in bash. However, it only works when you run a program from bash directly, not when programs other than bash themselves start programs. So even if you use bash, don't put a literal ~ in the path, make sure it's expanded or use $HOME instead.
When not in POSIX mode like when running as sh, as that feature breaks POSIX compliance as a PATH='~' is meant to look for commands in the literal ~ subdirectory of the current working directory.