Hi Vignesh,
Yes it is possible.
1. MSP's Unique ID field already exists as the unique identifier for a task. It is a simple read-only index number that you cannot manipulate.
2. For the situation you describe, you can create a new Custom Field of type "Text" and name of "NewUID" for example. Then have the values for "NewUID" computed automatically by using a formula to combine your "P" prefix with the "Unique ID" field. Here is the formula: NewUID = "P" & [Unique ID]. You could add your "NewUID" field to any view's table as needed. Since it is based on the Unique ID field, it's guaranteed to have no duplicates within your single project.
3. If you are looking for more of an intelligent-ID code, then you could experiment with using other text fields or an outline-code field as a prefix in place of the "P" above. At that point, you may be tempted to abandon the Unique ID in favor of some other numbering scheme that gives you more control over the sequencing. Then you may need to write some vba code (i.e. macro) help with the sequence numbering and checking for duplicates.
4. In addition to Unique ID, MSP also provides a hierarchical "WBS" structure that allows for defined code prefixes at each level (e.g. your "P" prefix) and provides/forces a single unique WBS value for each task in the schedule. (This is automatic, so you don't need vba.) I rarely use this.
Good luck, tmb