I agree with Shani that the song was inspired by Julian but it ended up being mostly about Paul.
This quote is from John's 1968 Rolling Stone interview:
"Well, when Paul first sang 'Hey Jude' to me... or played me the little tape he'd made of it... I took it very personally. 'Ah, it's me,' I said, 'It's me.' He says, 'No, it's me.' I said, 'Check. We're going through the same bit.' So we all are. Whoever is going through a bit with us is going through it, that's the groove."