Is it safe to delete python and pip versions 2 and 3

Probably, yes, since it's in /usr/local/bin (and so aren't the macOS system versions of python). However, you probably shouldn't just delete the executables from that directory, but the whole installation. The details of this will depend on how you did the installation, for example from Python.org, or homebrew, or anaconda.