Well, that’s simply the difference between Input Parsing and Output Parsing. Input parsing is parsed before ExpressionEngine tags, i.e. when you need to use PHP to provide input to a tag prior to its parsing, such as a parameter. Output parsing is parsed after ExpressionEngine tags, i.e. when the output of a tag is needed for some PHP code.
I take it you have a template where you feel a need to have some PHP parsed on Input, and other bits on Output? If so, you have a few simple solutions. The first, which I recommend most, is to convert one or the other to a plugin. The second is to use an embedded template for the Output code, as embeds are parsed after the parent template is fully parsed. You’ll need to pass the variables via embed tags and/or explicitly globally scope them so that the embedded template has access to the other PHP variables you are using.