Please try to understand the difference between what happens on the server and what happens on the client.
PHP and Python happen on the server, before the page is loaded. You can use this to change what HTML is shown depending on the request, but once the page is loaded you're pretty much done.
P5.js happens on the client, after the page is loaded. You can use this to modify what's already on the page, but you can't directly interact with server code.
Can I use Python inside p5.js?
No.
If I can't use Python can I use PHP inside p5.js and evoke Python within PHP?
No.
What you need to do is create requests from your P5.js code, which can trigger an endpoint on your server. This is called AJAX and there are a ton of resources online about it.